From 17ec73fad0f05cb23c2213ddc0ec2b798bbe6ab3 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Fri, 26 Oct 2018 10:39:11 +0800 Subject: fixes updatePreeditText method --- src/PYPBopomofoEditor.cc | 25 +++++++++++++++---------- src/PYPPinyinEditor.cc | 25 +++++++++++++++---------- 2 files changed, 30 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/PYPBopomofoEditor.cc b/src/PYPBopomofoEditor.cc index 8bf96e9..55eb130 100644 --- a/src/PYPBopomofoEditor.cc +++ b/src/PYPBopomofoEditor.cc @@ -342,22 +342,27 @@ BopomofoEditor::commit (const gchar *str) void BopomofoEditor::updatePreeditText () { + guint num = 0; + pinyin_get_n_candidate (m_instance, &num); + /* preedit text = guessed sentence + un-parsed pinyin text */ - if (G_UNLIKELY (m_text.empty () || m_candidates.empty () )) { + if (G_UNLIKELY (m_text.empty () || 0 == num)) { hidePreeditText (); return; } m_buffer.clear (); - EnhancedCandidate & candidate = m_candidates[0]; - String sentence = candidate.m_display_string; - if (CANDIDATE_NBEST_MATCH == candidate.m_candidate_type) { - if (m_props.modeSimp ()) { - m_buffer<