diff --git a/Source/Base.lproj/preferences.xib b/Source/Base.lproj/preferences.xib
index 25ee9a38..988a4209 100644
--- a/Source/Base.lproj/preferences.xib
+++ b/Source/Base.lproj/preferences.xib
@@ -19,14 +19,14 @@
-
+
-
+
-
+
@@ -35,7 +35,7 @@
-
+
@@ -47,7 +47,7 @@
-
+
@@ -56,7 +56,7 @@
-
+
@@ -84,7 +84,7 @@
-
+
@@ -93,7 +93,7 @@
-
+
@@ -114,7 +114,7 @@
-
+
@@ -134,7 +134,7 @@
-
+
@@ -143,7 +143,7 @@
-
+
@@ -161,7 +161,7 @@
-
+
@@ -248,7 +248,7 @@
-
+
@@ -274,7 +274,7 @@
-
+
@@ -297,7 +297,7 @@
-
+
+
+
+
+
+
+
+
+
+
diff --git a/Source/KeyHandler.mm b/Source/KeyHandler.mm
index 48049838..f1d6c41e 100644
--- a/Source/KeyHandler.mm
+++ b/Source/KeyHandler.mm
@@ -202,6 +202,20 @@ static NSString *const kGraphVizOutputfile = @"/tmp/McBopomofo-visualization.dot
_userOverrideModel->observe(_walkedNodes, cursorIndex, stringValue, [[NSDate date] timeIntervalSince1970]);
}
[self _walk];
+
+ if (Preferences.selectPhraseAfterCursorAsCandidate &&
+ Preferences.moveCursorAfterSelectingCandidate) {
+ size_t nextPosition = 0;
+ for (auto node: _walkedNodes) {
+ if (nextPosition >= cursorIndex) {
+ break;
+ }
+ nextPosition += node.spanningLength;
+ }
+ if (nextPosition < _builder->length()) {
+ _builder->setCursorIndex(nextPosition);
+ }
+ }
}
- (void)clear
diff --git a/Source/Preferences.swift b/Source/Preferences.swift
index 8d0b6f64..53775ff2 100644
--- a/Source/Preferences.swift
+++ b/Source/Preferences.swift
@@ -24,11 +24,15 @@
import Cocoa
private let kKeyboardLayoutPreferenceKey = "KeyboardLayout"
-private let kBasisKeyboardLayoutPreferenceKey = "BasisKeyboardLayout" // alphanumeric ("ASCII") input basi
-private let kFunctionKeyKeyboardLayoutPreferenceKey = "FunctionKeyKeyboardLayout" // alphanumeric ("ASCII") input basi
-private let kFunctionKeyKeyboardLayoutOverrideIncludeShiftKey = "FunctionKeyKeyboardLayoutOverrideIncludeShift" // whether include shif
+/// alphanumeric ("ASCII") input basic keyboard layout.
+private let kBasisKeyboardLayoutPreferenceKey = "BasisKeyboardLayout"
+/// alphanumeric ("ASCII") input basic keyboard layout.
+private let kFunctionKeyKeyboardLayoutPreferenceKey = "FunctionKeyKeyboardLayout"
+/// whether include shift.
+private let kFunctionKeyKeyboardLayoutOverrideIncludeShiftKey = "FunctionKeyKeyboardLayoutOverrideIncludeShift"
private let kCandidateListTextSizeKey = "CandidateListTextSize"
-private let kSelectPhraseAfterCursorAsCandidatePreferenceKey = "SelectPhraseAfterCursorAsCandidate"
+private let kSelectPhraseAfterCursorAsCandidateKey = "SelectPhraseAfterCursorAsCandidate"
+private let kMoveCursorAfterSelectingCandidateKey = "MoveCursorAfterSelectingCandidate"
private let kUseHorizontalCandidateListPreferenceKey = "UseHorizontalCandidateList"
private let kComposingBufferSizePreferenceKey = "ComposingBufferSize"
private let kChooseCandidateUsingSpaceKey = "ChooseCandidateUsingSpaceKey"
@@ -41,9 +45,8 @@ private let kCandidateKeyLabelFontName = "CandidateKeyLabelFontName"
private let kCandidateKeys = "CandidateKeys"
private let kPhraseReplacementEnabledKey = "PhraseReplacementEnabled"
private let kChineseConversionEngineKey = "ChineseConversionEngine"
-private let kChineseConversionStyle = "ChineseConversionStyle"
+private let kChineseConversionStyleKey = "ChineseConversionStyle"
private let kAssociatedPhrasesEnabledKey = "AssociatedPhrasesEnabled"
-//private let kAssociatedPhrasesKeys = "AssociatedPhrasesKeys"
private let kDefaultCandidateListTextSize: CGFloat = 16
private let kMinCandidateListTextSize: CGFloat = 12
@@ -204,7 +207,7 @@ class Preferences: NSObject {
kFunctionKeyKeyboardLayoutPreferenceKey,
kFunctionKeyKeyboardLayoutOverrideIncludeShiftKey,
kCandidateListTextSizeKey,
- kSelectPhraseAfterCursorAsCandidatePreferenceKey,
+ kSelectPhraseAfterCursorAsCandidateKey,
kUseHorizontalCandidateListPreferenceKey,
kComposingBufferSizePreferenceKey,
kChooseCandidateUsingSpaceKey,
@@ -216,7 +219,7 @@ class Preferences: NSObject {
kCandidateKeys,
kPhraseReplacementEnabledKey,
kChineseConversionEngineKey,
- kChineseConversionStyle,
+ kChineseConversionStyleKey,
kAssociatedPhrasesEnabledKey]
}
@@ -240,9 +243,12 @@ class Preferences: NSObject {
@CandidateListTextSize(key: kCandidateListTextSizeKey)
@objc static var candidateListTextSize: CGFloat
- @UserDefault(key: kSelectPhraseAfterCursorAsCandidatePreferenceKey, defaultValue: false)
+ @UserDefault(key: kSelectPhraseAfterCursorAsCandidateKey, defaultValue: false)
@objc static var selectPhraseAfterCursorAsCandidate: Bool
+ @UserDefault(key: kMoveCursorAfterSelectingCandidateKey, defaultValue: false)
+ @objc static var moveCursorAfterSelectingCandidate: Bool
+
@UserDefault(key: kUseHorizontalCandidateListPreferenceKey, defaultValue: false)
@objc static var useHorizontalCandidateList: Bool
@@ -362,7 +368,7 @@ class Preferences: NSObject {
///
/// - 0: convert the output
/// - 1: convert the phrase models.
- @UserDefault(key: kChineseConversionStyle, defaultValue: 0)
+ @UserDefault(key: kChineseConversionStyleKey, defaultValue: 0)
@objc static var chineseConversionStyle: Int
@objc static var chineseConversionStyleName: String? {
diff --git a/Source/README b/Source/README
index 994fe349..1092f5c7 100644
--- a/Source/README
+++ b/Source/README
@@ -2,6 +2,8 @@
├── AppDelegate.swift
├── Base.lproj
│ ├── Credits.rtf
+│ ├── InfoPlist.strings
+│ ├── Localizable.strings
│ ├── MainMenu.xib
│ ├── preferences.xib
│ ├── template-data.txt
@@ -16,6 +18,7 @@
│ ├── PhraseFreq.txt
│ ├── README
│ ├── Symbols.txt
+│ ├── associated-phrases.cin
│ ├── bin
│ │ ├── C_Version
│ │ │ ├── Makefile
@@ -59,6 +62,8 @@
│ │ └── falsecount.txt
│ └── phrase.occ
├── Engine
+│ ├── AssociatedPhrases.cpp
+│ ├── AssociatedPhrases.h
│ ├── CMakeLists.txt
│ ├── Gramambular
│ │ ├── Bigram.h
@@ -76,43 +81,12 @@
│ ├── KeyValueBlobReader.h
│ ├── KeyValueBlobReaderTest.cpp
│ ├── Mandarin
+│ │ ├── CMakeLists.txt
│ │ ├── Mandarin.cpp
-│ │ └── Mandarin.h
+│ │ ├── Mandarin.h
+│ │ └── MandarinTest.cpp
│ ├── McBopomofoLM.cpp
│ ├── McBopomofoLM.h
-│ ├── OpenVanilla
-│ │ ├── OVAroundFilter.h
-│ │ ├── OVBase.h
-│ │ ├── OVBenchmark.h
-│ │ ├── OVCINDataTable.h
-│ │ ├── OVCINDatabaseService.h
-│ │ ├── OVCINToSQLiteConvertor.h
-│ │ ├── OVCandidateService.h
-│ │ ├── OVDatabaseService.h
-│ │ ├── OVDateTimeHelper.h
-│ │ ├── OVEncodingService.h
-│ │ ├── OVEventHandlingContext.h
-│ │ ├── OVException.h
-│ │ ├── OVFileHelper.h
-│ │ ├── OVFrameworkInfo.h
-│ │ ├── OVInputMethod.h
-│ │ ├── OVKey.h
-│ │ ├── OVKeyPreprocessor.h
-│ │ ├── OVKeyValueMap.h
-│ │ ├── OVLoaderBase.h
-│ │ ├── OVLoaderService.h
-│ │ ├── OVLocalization.h
-│ │ ├── OVModule.h
-│ │ ├── OVModulePackage.h
-│ │ ├── OVOutputFilter.h
-│ │ ├── OVPathInfo.h
-│ │ ├── OVSQLiteDatabaseService.h
-│ │ ├── OVSQLiteWrapper.h
-│ │ ├── OVStringHelper.h
-│ │ ├── OVTextBuffer.h
-│ │ ├── OVUTF8Helper.h
-│ │ ├── OVWildcard.h
-│ │ └── OpenVanilla.h
│ ├── ParselessLM.cpp
│ ├── ParselessLM.h
│ ├── ParselessLMBenchmark.cpp
@@ -205,4 +179,4 @@
├── template-exclude-phrases.txt
└── template-phrases-replacement.txt
-23 directories, 182 files
+22 directories, 157 files
diff --git a/Source/zh-Hant.lproj/preferences.xib b/Source/zh-Hant.lproj/preferences.xib
index 3aad70ae..91ecee15 100644
--- a/Source/zh-Hant.lproj/preferences.xib
+++ b/Source/zh-Hant.lproj/preferences.xib
@@ -19,14 +19,14 @@
-
+
-
+
-
+
@@ -49,7 +49,7 @@
-
+
@@ -58,7 +58,7 @@
-
+
@@ -70,16 +70,16 @@
-
+
-
+
-
+
@@ -88,7 +88,7 @@
-
+
@@ -97,7 +97,7 @@
-
+
@@ -123,7 +123,7 @@
-
+
@@ -149,7 +149,7 @@
-
+
@@ -172,7 +172,7 @@
-
+
@@ -183,7 +183,7 @@
-
+
@@ -200,7 +200,7 @@
-
+
@@ -209,7 +209,7 @@
-
+
@@ -220,7 +220,7 @@
-
+
@@ -232,7 +232,7 @@
-
+
@@ -267,7 +267,7 @@
-
+
@@ -313,9 +313,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
-
+