KeyHandler // Let Front-Cursor mode select phrase when index == 0.

This commit is contained in:
ShikiSuen 2022-04-21 15:49:17 +08:00
parent fd2074b44e
commit a240da5297
3 changed files with 11 additions and 1 deletions

View File

@ -74,6 +74,7 @@ struct BufferStatePackage
- (BOOL)isPrintable:(UniChar)charCode;
- (NSArray<NSString *> *)buildAssociatePhraseArrayWithKey:(NSString *)key;
- (NSArray<NSString *> *)getCandidatesArray;
- (NSInteger)getKeyLengthAtIndexZero;
- (NSInteger)getBuilderCursorIndex;
- (NSInteger)getBuilderLength;
- (NSInteger)getPackagedCursorIndex;

View File

@ -623,6 +623,11 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
return candidatesArray;
}
- (NSInteger)getKeyLengthAtIndexZero
{
return [NSString stringWithUTF8String:_walkedNodes[0].node->currentKeyValue().value.c_str()].length;
}
#pragma mark - 威注音認為有必要單獨拿出來處理的部分,交給 Swift 則有些困難。
- (BOOL)isPrintable:(UniChar)charCode

View File

@ -41,7 +41,11 @@ import Cocoa
&& (cursorIndex < getBuilderLength()))
|| cursorIndex == 0
{
cursorIndex += 1
if cursorIndex == 0 && !mgrPrefs.setRearCursorMode {
cursorIndex += getKeyLengthAtIndexZero()
} else {
cursorIndex += 1
}
}
return cursorIndex
}