From e6438371f64fcf3791f37e30f9a66f6282276961 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Mon, 25 Jun 2018 11:23:42 +0800 Subject: write updateLookupTableFast method of class SuggestionEditor --- src/PYPSuggestionEditor.cc | 24 ++++++++++++++++++++---- src/PYPSuggestionEditor.h | 1 + 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/PYPSuggestionEditor.cc b/src/PYPSuggestionEditor.cc index ea3dba0..27b07d1 100644 --- a/src/PYPSuggestionEditor.cc +++ b/src/PYPSuggestionEditor.cc @@ -217,7 +217,9 @@ void SuggestionEditor::pageUp (void) { if (G_LIKELY (m_lookup_table.pageUp ())) { - update (); + updateLookupTableFast (); + updatePreeditText (); + updateAuxiliaryText (); } } @@ -225,7 +227,9 @@ void SuggestionEditor::pageDown (void) { if (G_LIKELY (m_lookup_table.pageDown ())) { - update (); + updateLookupTableFast (); + updatePreeditText (); + updateAuxiliaryText (); } } @@ -233,7 +237,9 @@ void SuggestionEditor::cursorUp (void) { if (G_LIKELY (m_lookup_table.cursorUp ())) { - update (); + updateLookupTableFast (); + updatePreeditText (); + updateAuxiliaryText (); } } @@ -241,7 +247,9 @@ void SuggestionEditor::cursorDown (void) { if (G_LIKELY (m_lookup_table.cursorDown ())) { - update (); + updateLookupTableFast (); + updatePreeditText (); + updateAuxiliaryText (); } } @@ -262,6 +270,12 @@ SuggestionEditor::reset (void) update (); } +void +SuggestionEditor::updateLookupTableFast (void) +{ + Editor::updateLookupTableFast (m_lookup_table, TRUE); +} + void SuggestionEditor::updateLookupTable (void) { @@ -275,6 +289,8 @@ SuggestionEditor::updateLookupTable (void) Editor::updateLookupTableFast (m_lookup_table, TRUE); } else { hideLookupTable (); + /* clean up prefix */ + m_text = ""; } } diff --git a/src/PYPSuggestionEditor.h b/src/PYPSuggestionEditor.h index 8ad0a60..ed45c2f 100644 --- a/src/PYPSuggestionEditor.h +++ b/src/PYPSuggestionEditor.h @@ -58,6 +58,7 @@ protected: private: void updateLookupTable (void); + void updateLookupTableFast (); gboolean updateCandidates (); gboolean fillLookupTable (); void updatePreeditText (void); -- cgit