summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2022-09-26 14:25:43 +0800
committerPeng Wu <alexepico@gmail.com>2022-09-26 14:25:43 +0800
commit13181349a6a481bcf3898a4f41178dafe25a79f8 (patch)
treedd5df1475a9cf3e5f6c7b6faf6397eaf371090c3
parentd88ecd60db2942ca05d21b65158d257568556d27 (diff)
downloadibus-libpinyin-13181349a6a481bcf3898a4f41178dafe25a79f8.tar.gz
Support Legacy mode
-rw-r--r--src/PYPConfig.cc4
-rw-r--r--src/PYPLibPinyinCandidates.cc8
-rw-r--r--src/PYPPhoneticEditor.cc5
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 ());