diff options
author | Peng Wu <alexepico@gmail.com> | 2016-07-25 14:12:01 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2016-07-25 14:12:01 +0800 |
commit | 836be38da7c108288a922d85f1d212b5ef518a6d (patch) | |
tree | 616945df1231ca3d1c68a8eaa892e969c102079f | |
parent | b2819139121d302ea1c86eac1c5dbc22f1f70b22 (diff) | |
download | ibus-libpinyin-836be38da7c108288a922d85f1d212b5ef518a6d.tar.gz ibus-libpinyin-836be38da7c108288a922d85f1d212b5ef518a6d.tar.xz ibus-libpinyin-836be38da7c108288a922d85f1d212b5ef518a6d.zip |
work around getLookupCursor
-rw-r--r-- | src/PYPPhoneticEditor.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/PYPPhoneticEditor.cc b/src/PYPPhoneticEditor.cc index 0ef11d7..517bac4 100644 --- a/src/PYPPhoneticEditor.cc +++ b/src/PYPPhoneticEditor.cc @@ -365,8 +365,15 @@ PhoneticEditor::getLookupCursor (void) { guint lookup_cursor = getPinyinCursor (); + /* as pinyin_get_pinyin_offset can't handle the last "'" characters, + strip the string to work around it here. */ + String stripped = m_text; + size_t pos = stripped.find_last_not_of ("'") + 1; + if (pos < stripped.length ()) + stripped.erase (pos); + /* show candidates when pinyin cursor is at end. */ - if (lookup_cursor == m_text.length ()) + if (lookup_cursor == stripped.length ()) lookup_cursor = 0; return lookup_cursor; } |