From b369106719ff4ea9c8143957d4744ae95d3d0de0 Mon Sep 17 00:00:00 2001 From: "Lukhnos D. Liu" Date: Sun, 6 May 2012 15:52:33 -0700 Subject: [PATCH] Add Home/End key support in candidate panels. --- Source/InputMethodController.mm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Source/InputMethodController.mm b/Source/InputMethodController.mm index cc23b460..7406c861 100644 --- a/Source/InputMethodController.mm +++ b/Source/InputMethodController.mm @@ -605,6 +605,27 @@ enum { return YES; } } + else if (keyCode == kHomeKeyCode) { + if (LTCurrentCandidateController.selectedCandidateIndex == 0) { + [self beep]; + + } + else { + LTCurrentCandidateController.selectedCandidateIndex = 0; + } + + return YES; + } + else if (keyCode == kEndKeyCode && [_candidates count] > 0) { + if (LTCurrentCandidateController.selectedCandidateIndex == [_candidates count] - 1) { + [self beep]; + } + else { + LTCurrentCandidateController.selectedCandidateIndex = [_candidates count] - 1; + } + + return YES; + } else { NSInteger index = NSNotFound;