Skip to content

Commit

Permalink
fix(SquirrelInputController): commit raw input when switching to othe…
Browse files Browse the repository at this point in the history
…r IME, closes #146
  • Loading branch information
lotem committed Feb 13, 2021
1 parent 327b7d0 commit b875d19
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions SquirrelInputController.m
Original file line number Diff line number Diff line change
Expand Up @@ -307,12 +307,13 @@ -(void)deactivateServer:(id)sender
-(void)commitComposition:(id)sender
{
//NSLog(@"commitComposition:");
// - FIXME: chrome's address bar issues this callback when showing suggestions.
if ([[sender bundleIdentifier] isEqualToString:@"com.google.Chrome"])
return;
// force committing existing Rime composition
if (_session && rime_get_api()->commit_composition(_session)) {
[self rimeConsumeCommittedText];
// commit raw input
if (_session) {
const char* raw_input = rime_get_api()->get_input(_session);
if (raw_input) {
[self commitString: @(raw_input)];
rime_get_api()->clear_composition(_session);
}
}
}

Expand Down

1 comment on commit b875d19

@GJRobert
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is handy, too. Thanks a lot~~~

Please sign in to comment.