Skip to content

Commit

Permalink
fix #43
Browse files Browse the repository at this point in the history
  • Loading branch information
dongyuwei committed Jun 28, 2019
1 parent eeac06b commit 2562ed4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
1 change: 0 additions & 1 deletion src/AnnotationWinController.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ - (void)showWindow:(NSPoint)origin {
}

- (void)hideWindow {
// [[self panel] orderOut:nil];
NSRect rect;
rect.size.width = 0;
rect.size.height = 0;
Expand Down
30 changes: 18 additions & 12 deletions src/InputController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,21 @@ - (BOOL)onKeyEvent:(NSEvent *)event client:(id)sender {
}

if ([self isMojaveAndLaterSystem]) {
if (keyCode == KEY_ARROW_DOWN) {
[sharedCandidates moveDown:self];
_currentCandidateIndex++;
return NO;
}

if (keyCode == KEY_ARROW_UP) {
[sharedCandidates moveUp:self];
_currentCandidateIndex--;
return NO;
BOOL isCandidatesVisible = [sharedCandidates isVisible];
if (isCandidatesVisible) {
if (keyCode == KEY_ARROW_DOWN) {
[sharedCandidates moveDown:self];
_currentCandidateIndex++;
return NO;
}

if (keyCode == KEY_ARROW_UP) {
[sharedCandidates moveUp:self];
_currentCandidateIndex--;
return NO;
}
}


if ([[NSCharacterSet decimalDigitCharacterSet] characterIsMember:ch]) {
if (!hasBufferedText) {
Expand All @@ -140,7 +144,7 @@ - (BOOL)onKeyEvent:(NSEvent *)event client:(id)sender {
return YES;
}

if ([sharedCandidates isVisible]) { // use 1~9 digital numbers as selection keys
if (isCandidatesVisible) { // use 1~9 digital numbers as selection keys
int pressedNumber = [characters intValue];
NSString *candidate;
int pageSize = 9;
Expand Down Expand Up @@ -216,9 +220,11 @@ - (void)reset {
[self setOriginalBuffer:@""];
_insertionIndex = 0;
_currentCandidateIndex = 1;
[sharedCandidates clearSelection];
[sharedCandidates hide];
[_annotationWin hideWindow];
_candidates = [[NSMutableArray alloc] init];
[sharedCandidates setCandidateData: @[]];
[_annotationWin hideWindow];
}

- (NSMutableString *)composedBuffer {
Expand Down

0 comments on commit 2562ed4

Please sign in to comment.