From 98d590904e87f4cc7175a4318ad63db22ca7185b Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Sun, 6 Mar 2022 14:12:21 +0800 Subject: [PATCH] KeyHandler // Simplify: _actualCandidateCursorIndex. --- Source/Modules/ControllerModules/KeyHandler.mm | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Source/Modules/ControllerModules/KeyHandler.mm b/Source/Modules/ControllerModules/KeyHandler.mm index 759f9541..46883043 100644 --- a/Source/Modules/ControllerModules/KeyHandler.mm +++ b/Source/Modules/ControllerModules/KeyHandler.mm @@ -1429,15 +1429,10 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot"; - (size_t)_actualCandidateCursorIndex { size_t cursorIndex = _builder->cursorIndex(); - if (Preferences.selectPhraseAfterCursorAsCandidate) { - // MS Phonetics IME style, phrase is *after* the cursor, i.e. cursor is always *before* the phrase - if (cursorIndex < _builder->length()) { - ++cursorIndex; - } - } else { - if (!cursorIndex) { - ++cursorIndex; - } + // MS Phonetics IME style, phrase is *after* the cursor, i.e. cursor is always *before* the phrase + if ((Preferences.selectPhraseAfterCursorAsCandidate && (cursorIndex < _builder->length())) + || !cursorIndex) { + ++cursorIndex; } return cursorIndex;