8000 Better Option Update Display by LEOYoon-Tsaw · Pull Request #540 · rime/squirrel · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Better Option Update Display #540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 7 additions & 19 deletions SquirrelApplicationDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ void show_message(const char* msg_text, const char* msg_id) {
static void show_status_message(const char* msg_text, const char* msg_id) {
SquirrelPanel* panel = NSApp.squirrelAppDelegate.panel;
if (panel) {
[panel updateStatus:NSLocalizedString(@(msg_text), nil)];
NSString *message = @(msg_text);
[panel updateStatus: message];
}
}

Expand Down Expand Up @@ -84,24 +85,11 @@ void notification_handler(void* context_object, RimeSessionId session_id,
}
// option change
if (!strcmp(message_type, "option")) {
if (!strcmp(message_value, "ascii_mode") ||
!strcmp(message_value, "!ascii_mode")) {
static bool was_ascii_mode = false;
bool is_ascii_mode = (message_value[0] != '!');
if (is_ascii_mode != was_ascii_mode) {
was_ascii_mode = is_ascii_mode;
show_status_message(message_value, message_type);
}
}
else if (!strcmp(message_value, "full_shape") ||
!strcmp(message_value, "!full_shape") ||
!strcmp(message_value, "ascii_punct") ||
!strcmp(message_value, "!ascii_punct") ||
!strcmp(message_value, "simplification") ||
!strcmp(message_value, "!simplification") ||
!strcmp(message_value, "extended_charset") ||
!strcmp(message_value, "!extended_charset")) {
show_status_message(message_value, message_type);
Bool state = message_value[0] != '!';
const char* option_name = message_value + !state;
const char *state_label = rime_get_api()->get_state_label(session_id, option_name, state);
if (state_label) {
show_status_message(state_label, message_type);
}
}
}
Expand Down
0