summaryrefslogtreecommitdiffstats
path: root/src/PYPFullPinyinEditor.cc
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2023-05-26 13:05:30 +0800
committerPeng Wu <alexepico@gmail.com>2023-05-26 13:05:30 +0800
commit240348e4b6bfd531e959b8f91f76b1e7acc7c70a (patch)
tree09c213d16f63a2c704c424c2eff54ebe1b0e3d73 /src/PYPFullPinyinEditor.cc
parent78b57203ff1788908d1ef0a55fa4c2c5ca98fd37 (diff)
downloadibus-libpinyin-240348e4b6bfd531e959b8f91f76b1e7acc7c70a.tar.gz
ibus-libpinyin-240348e4b6bfd531e959b8f91f76b1e7acc7c70a.tar.xz
ibus-libpinyin-240348e4b6bfd531e959b8f91f76b1e7acc7c70a.zip
Fix FullPinyinEditor::insert method
Diffstat (limited to 'src/PYPFullPinyinEditor.cc')
-rw-r--r--src/PYPFullPinyinEditor.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/PYPFullPinyinEditor.cc b/src/PYPFullPinyinEditor.cc
index 7c0eab8..0c6bf3e 100644
--- a/src/PYPFullPinyinEditor.cc
+++ b/src/PYPFullPinyinEditor.cc
@@ -50,10 +50,12 @@ FullPinyinEditor::insert (gint ch)
if (G_UNLIKELY (m_text.length () >= MAX_PINYIN_LEN))
return TRUE;
+#if 0
/* for i/u/v mode */
if (m_text.empty () &&
(ch == 'i' || ch == 'u' || ch == 'v'))
return FALSE;
+#endif
m_text.insert (m_cursor++, ch);
@@ -68,6 +70,18 @@ FullPinyinEditor::processKeyEvent (guint keyval,
guint keycode,
guint modifiers)
{
+ /* handle 'A' - 'Z' key */
+ if (G_UNLIKELY (IBUS_A <= keyval && keyval <= IBUS_Z)) {
+ if (cmshm_filter (modifiers) == 0) {
+
+ if (m_text.empty ())
+ return FALSE;
+
+ if (insert (keyval))
+ return TRUE;
+ }
+ }
+
return PinyinEditor::processKeyEvent (keyval, keycode, modifiers);
}