diff options
author | Peng Wu <alexepico@gmail.com> | 2022-09-26 14:25:43 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2022-09-26 14:25:43 +0800 |
commit | 13181349a6a481bcf3898a4f41178dafe25a79f8 (patch) | |
tree | dd5df1475a9cf3e5f6c7b6faf6397eaf371090c3 | |
parent | d88ecd60db2942ca05d21b65158d257568556d27 (diff) | |
download | ibus-libpinyin-13181349a6a481bcf3898a4f41178dafe25a79f8.tar.gz |
Support Legacy mode
-rw-r--r-- | src/PYPConfig.cc | 4 | ||||
-rw-r--r-- | src/PYPLibPinyinCandidates.cc | 8 | ||||
-rw-r--r-- | src/PYPPhoneticEditor.cc | 5 |
3 files changed, 16 insertions, 1 deletions
diff --git a/src/PYPConfig.cc b/src/PYPConfig.cc index 4730036..06b3ff8 100644 --- a/src/PYPConfig.cc +++ b/src/PYPConfig.cc @@ -205,7 +205,9 @@ static const struct{ guint sort_option; } sort_options [] = { {0, SORT_BY_PHRASE_LENGTH | SORT_BY_FREQUENCY}, - {1, SORT_BY_PHRASE_LENGTH | SORT_BY_PINYIN_LENGTH | SORT_BY_FREQUENCY} + {1, SORT_BY_PHRASE_LENGTH | SORT_BY_PINYIN_LENGTH | SORT_BY_FREQUENCY}, + {2, SORT_WITHOUT_SENTENCE_CANDIDATE | SORT_WITHOUT_LONGER_CANDIDATE | + SORT_BY_PHRASE_LENGTH | SORT_BY_PINYIN_LENGTH | SORT_BY_FREQUENCY} }; static const struct{ diff --git a/src/PYPLibPinyinCandidates.cc b/src/PYPLibPinyinCandidates.cc index 6fdfb49..dd3d409 100644 --- a/src/PYPLibPinyinCandidates.cc +++ b/src/PYPLibPinyinCandidates.cc @@ -136,6 +136,14 @@ LibPinyinCandidates::selectCandidate (EnhancedCandidate & enhanced) return SELECT_CANDIDATE_COMMIT; } + if (m_editor->m_config.sortOption () & SORT_WITHOUT_SENTENCE_CANDIDATE) { + pinyin_choose_candidate (instance, 0, candidate); + + LibPinyinBackEnd::instance ().modified (); + + return SELECT_CANDIDATE_COMMIT; + } + lookup_cursor = pinyin_choose_candidate (instance, lookup_cursor, candidate); diff --git a/src/PYPPhoneticEditor.cc b/src/PYPPhoneticEditor.cc index bba9dfb..ee0b8ce 100644 --- a/src/PYPPhoneticEditor.cc +++ b/src/PYPPhoneticEditor.cc @@ -343,6 +343,11 @@ void PhoneticEditor::update (void) { guint lookup_cursor = getLookupCursor (); + + /* The lookup cursor is not moved here. */ + if (m_config.sortOption () & SORT_WITHOUT_SENTENCE_CANDIDATE) + lookup_cursor = 0; + pinyin_guess_candidates (m_instance, lookup_cursor, m_config.sortOption ()); |