Fixes crashes for Full Pinyin and Bopomofo
This commit is contained in:
parent
588a653ec9
commit
2a9c342573
@ -0,0 +1,86 @@
|
|||||||
|
diff --git a/src/PYPBopomofoEditor.cc b/src/PYPBopomofoEditor.cc
|
||||||
|
index a48a856..be89eb5 100644
|
||||||
|
--- a/src/PYPBopomofoEditor.cc
|
||||||
|
+++ b/src/PYPBopomofoEditor.cc
|
||||||
|
@@ -329,7 +329,7 @@ BopomofoEditor::updatePreeditText ()
|
||||||
|
|
||||||
|
size_t offset = 0;
|
||||||
|
guint cursor = getPinyinCursor ();
|
||||||
|
- g_assert (pinyin_get_character_offset(m_instance, sentence, cursor, &offset));
|
||||||
|
+ pinyin_get_character_offset(m_instance, sentence, cursor, &offset);
|
||||||
|
Editor::updatePreeditText (preedit_text, offset, TRUE);
|
||||||
|
|
||||||
|
if (sentence)
|
||||||
|
diff --git a/src/PYPFullPinyinEditor.cc b/src/PYPFullPinyinEditor.cc
|
||||||
|
index 70de09f..b0ad3d7 100644
|
||||||
|
--- a/src/PYPFullPinyinEditor.cc
|
||||||
|
+++ b/src/PYPFullPinyinEditor.cc
|
||||||
|
@@ -116,3 +116,21 @@ FullPinyinEditor::update (void)
|
||||||
|
updatePreeditText ();
|
||||||
|
updateAuxiliaryText ();
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+guint
|
||||||
|
+FullPinyinEditor::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 == stripped.length ())
|
||||||
|
+ lookup_cursor = 0;
|
||||||
|
+ return lookup_cursor;
|
||||||
|
+}
|
||||||
|
diff --git a/src/PYPFullPinyinEditor.h b/src/PYPFullPinyinEditor.h
|
||||||
|
index cffbdd9..84a160f 100644
|
||||||
|
--- a/src/PYPFullPinyinEditor.h
|
||||||
|
+++ b/src/PYPFullPinyinEditor.h
|
||||||
|
@@ -44,6 +44,8 @@ protected:
|
||||||
|
|
||||||
|
virtual void updatePinyin (void);
|
||||||
|
|
||||||
|
+ virtual guint getLookupCursor (void);
|
||||||
|
+
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
diff --git a/src/PYPPhoneticEditor.cc b/src/PYPPhoneticEditor.cc
|
||||||
|
index 517bac4..0ef11d7 100644
|
||||||
|
--- a/src/PYPPhoneticEditor.cc
|
||||||
|
+++ b/src/PYPPhoneticEditor.cc
|
||||||
|
@@ -365,15 +365,8 @@ 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 == stripped.length ())
|
||||||
|
+ if (lookup_cursor == m_text.length ())
|
||||||
|
lookup_cursor = 0;
|
||||||
|
return lookup_cursor;
|
||||||
|
}
|
||||||
|
diff --git a/src/PYPPinyinEditor.cc b/src/PYPPinyinEditor.cc
|
||||||
|
index 4ed475f..b7ab8c3 100644
|
||||||
|
--- a/src/PYPPinyinEditor.cc
|
||||||
|
+++ b/src/PYPPinyinEditor.cc
|
||||||
|
@@ -266,7 +266,7 @@ PinyinEditor::updatePreeditText ()
|
||||||
|
|
||||||
|
size_t offset = 0;
|
||||||
|
guint cursor = getPinyinCursor ();
|
||||||
|
- g_assert (pinyin_get_character_offset(m_instance, sentence, cursor, &offset));
|
||||||
|
+ pinyin_get_character_offset(m_instance, sentence, cursor, &offset);
|
||||||
|
Editor::updatePreeditText (preedit_text, offset, TRUE);
|
||||||
|
|
||||||
|
if (sentence)
|
@ -1,8 +1,8 @@
|
|||||||
%global snapshot 0
|
%global snapshot 1
|
||||||
|
|
||||||
Name: ibus-libpinyin
|
Name: ibus-libpinyin
|
||||||
Version: 1.7.92
|
Version: 1.7.92
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
Summary: Intelligent Pinyin engine based on libpinyin for IBus
|
Summary: Intelligent Pinyin engine based on libpinyin for IBus
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
Group: System Environment/Libraries
|
Group: System Environment/Libraries
|
||||||
@ -86,6 +86,9 @@ make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"
|
|||||||
%{_datadir}/ibus/component/*
|
%{_datadir}/ibus/component/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Aug 9 2016 Peng Wu <pwu@redhat.com> - 1.7.92-2
|
||||||
|
- Fixes crashes for Full Pinyin and Bopomofo
|
||||||
|
|
||||||
* Tue Aug 2 2016 Peng Wu <pwu@redhat.com> - 1.7.92-1
|
* Tue Aug 2 2016 Peng Wu <pwu@redhat.com> - 1.7.92-1
|
||||||
- Update to 1.7.92
|
- Update to 1.7.92
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user