Skip to content

Commit

Permalink
空格键提交时自动附加一个空格;enter回车提交选择时不自动附加空格
Browse files Browse the repository at this point in the history
  • Loading branch information
dongyuwei committed May 20, 2017
1 parent ca38f10 commit abdcd47
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/InputController.m
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,23 @@ -(BOOL)onKeyEvent:(NSEvent*)event client:(id)sender{
return NO;
}

if(keyCode == KEY_RETURN || keyCode == KEY_SPACE){
if(keyCode == KEY_RETURN){
if ( bufferedText && [bufferedText length] > 0 ) {
[self commitComposition:sender];
return YES;
}
return NO;
}


if(keyCode == KEY_SPACE){
if ( bufferedText && [bufferedText length] > 0 ) {
[self appendToComposedBuffer: @" "];
[self commitComposition:sender];
return YES;
}
return NO;
}

if(keyCode == KEY_ESC){
if ( bufferedText && [bufferedText length] > 0 ) {
[self cancelComposition];
Expand Down

0 comments on commit abdcd47

Please sign in to comment.