From 0131f8038064cc375f77375f1b7e612478a780d8 Mon Sep 17 00:00:00 2001 From: fxliang Date: Wed, 18 Oct 2023 07:20:45 +0800 Subject: [PATCH] feat: add reload command for rime_api_console (#741) --- tools/rime_api_console.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/rime_api_console.cc b/tools/rime_api_console.cc index 6755707d7f..cd4fd0ad1b 100644 --- a/tools/rime_api_console.cc +++ b/tools/rime_api_console.cc @@ -219,6 +219,7 @@ int main(int argc, char* argv[]) { rime->set_notification_handler(&on_message, NULL); fprintf(stderr, "initializing...\n"); +reload: rime->initialize(NULL); Bool full_check = False; if (rime->start_maintenance(full_check)) { @@ -250,6 +251,11 @@ int main(int argc, char* argv[]) { } if (!strcmp(line, "exit")) break; + else if (!strcmp(line, "reload")) { + rime->destroy_session(session_id); + rime->finalize(); + goto reload; + } if (execute_special_command(line, session_id)) continue; if (rime->simulate_key_sequence(session_id, line)) {