diff options
author | Peng Wu <alexepico@gmail.com> | 2022-05-19 09:46:31 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2022-05-19 09:46:31 +0800 |
commit | 11a75d2429760bdc291bf82e385110f418b14610 (patch) | |
tree | f177f2a7d4257dbf9a0c0cb88b3a74028626b9aa | |
parent | 109de24d222478edaae4cadcdf31e0aec89b44ee (diff) | |
download | ibus-libpinyin-11a75d2429760bdc291bf82e385110f418b14610.tar.gz |
Fixes class PunctEditor
-rw-r--r-- | src/PYPunctEditor.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/PYPunctEditor.cc b/src/PYPunctEditor.cc index 54a32ef..adcb839 100644 --- a/src/PYPunctEditor.cc +++ b/src/PYPunctEditor.cc @@ -256,7 +256,7 @@ PunctEditor::cursorUp (void) void PunctEditor::cursorDown (void) { - if (G_LIKELY (m_lookup_table.cursorDown ())) { + if (G_LIKELY (m_lookup_table.size () && m_lookup_table.cursorDown ())) { m_selected_puncts[m_cursor - 1] = m_punct_candidates[m_lookup_table.cursorPos ()]; updateLookupTableFast (m_lookup_table, TRUE); updatePreeditText (); @@ -301,8 +301,8 @@ PunctEditor::moveCursorRight (void) it = std::find (m_punct_candidates.begin (), m_punct_candidates.end (), m_selected_puncts[m_cursor - 1]); - g_assert (it != m_punct_candidates.end ()); - m_lookup_table.setCursorPos (it - m_punct_candidates.begin ()); + if (it != m_punct_candidates.end ()) + m_lookup_table.setCursorPos (it - m_punct_candidates.begin ()); update(); return TRUE; @@ -314,7 +314,7 @@ PunctEditor::moveCursorToBegin (void) if (G_UNLIKELY (m_cursor == 0)) return FALSE; - g_assert (m_punct_mode == MODE_NORMAL); + g_assert (m_punct_mode == MODE_INIT || m_punct_mode == MODE_NORMAL); m_cursor = 0; m_punct_candidates.clear (); fillLookupTable (); |