diff --git a/SOURCES/ibus-libpinyin-fixes-period-and-comma-handling.patch b/SOURCES/ibus-libpinyin-fixes-period-and-comma-handling.patch new file mode 100644 index 0000000..6696d9e --- /dev/null +++ b/SOURCES/ibus-libpinyin-fixes-period-and-comma-handling.patch @@ -0,0 +1,158 @@ +From 1eb70ce12bed9d6b53c02ac8693ec52abe1d0216 Mon Sep 17 00:00:00 2001 +From: Peng Wu +Date: Wed, 20 Nov 2019 19:12:47 +0800 +Subject: [PATCH 1/3] fixes period handling + +--- + src/PYFallbackEditor.cc | 1 + + src/PYPPinyinEditor.cc | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/PYFallbackEditor.cc b/src/PYFallbackEditor.cc +index e3dcfba..12985f4 100644 +--- a/src/PYFallbackEditor.cc ++++ b/src/PYFallbackEditor.cc +@@ -219,6 +219,7 @@ FallbackEditor::processKeyEvent (guint keyval, guint keycode, guint modifiers) + case IBUS_A ... IBUS_Z: + if (modifiers == 0) { + if (!m_props.modeFull ()) ++ m_prev_committed_char = keyval; + return FALSE; + + commit (HalfFullConverter::toFull (keyval)); +diff --git a/src/PYPPinyinEditor.cc b/src/PYPPinyinEditor.cc +index d2741b0..55bbb63 100644 +--- a/src/PYPPinyinEditor.cc ++++ b/src/PYPPinyinEditor.cc +@@ -130,7 +130,7 @@ PinyinEditor::processPunct (guint keyval, guint keycode, + return FALSE; + } + +- return TRUE; ++ return FALSE; + } + + inline gboolean +-- +2.26.2 + + +From 592b628000d9b58bb714ff9232d7d2ddf814cacf Mon Sep 17 00:00:00 2001 +From: Peng Wu +Date: Thu, 21 Nov 2019 14:45:28 +0800 +Subject: [PATCH 2/3] fixes period handling again + +--- + src/PYFallbackEditor.cc | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/src/PYFallbackEditor.cc b/src/PYFallbackEditor.cc +index 12985f4..3d03b49 100644 +--- a/src/PYFallbackEditor.cc ++++ b/src/PYFallbackEditor.cc +@@ -218,9 +218,10 @@ FallbackEditor::processKeyEvent (guint keyval, guint keycode, guint modifiers) + case IBUS_a ... IBUS_z: + case IBUS_A ... IBUS_Z: + if (modifiers == 0) { +- if (!m_props.modeFull ()) ++ if (!m_props.modeFull ()) { + m_prev_committed_char = keyval; + return FALSE; ++ } + + commit (HalfFullConverter::toFull (keyval)); + retval = TRUE; +@@ -261,8 +262,10 @@ FallbackEditor::processKeyEvent (guint keyval, guint keycode, guint modifiers) + keyval = IBUS_space; + case IBUS_space: + if (modifiers == 0) { +- if (!m_props.modeFull ()) ++ if (!m_props.modeFull ()) { ++ m_prev_committed_char = keyval; + return FALSE; ++ } + + commit (" "); + retval = TRUE; +@@ -272,6 +275,9 @@ FallbackEditor::processKeyEvent (guint keyval, guint keycode, guint modifiers) + default: + break; + } ++ ++ if (!retval) ++ m_prev_committed_char = keyval; + return retval; + } + +-- +2.26.2 + + +From 17121ad1dbc8c9be44d449c2d79179cdd90f6d7c Mon Sep 17 00:00:00 2001 +From: Peng Wu +Date: Fri, 29 Nov 2019 13:23:16 +0800 +Subject: [PATCH 3/3] fixes comma handling + +--- + src/PYFallbackEditor.cc | 32 ++++++++++++++++++++++++-------- + 1 file changed, 24 insertions(+), 8 deletions(-) + +diff --git a/src/PYFallbackEditor.cc b/src/PYFallbackEditor.cc +index 3d03b49..6020591 100644 +--- a/src/PYFallbackEditor.cc ++++ b/src/PYFallbackEditor.cc +@@ -76,13 +76,21 @@ FallbackEditor::processPunctForSimplifiedChinese (guint keyval, guint keycode, g + m_double_quote = !m_double_quote; + return TRUE; + case ',': +- commit (","); return TRUE; ++ if (m_prev_committed_char >= '0' && m_prev_committed_char <= '9') { ++ m_prev_committed_char = keyval; ++ return FALSE; ++ } else { ++ commit (","); ++ return TRUE; ++ } + case '.': +- if (m_prev_committed_char >= '0' && m_prev_committed_char <= '9') ++ if (m_prev_committed_char >= '0' && m_prev_committed_char <= '9') { ++ m_prev_committed_char = keyval; + return FALSE; +- else ++ } else { + commit ("。"); +- return TRUE; ++ return TRUE; ++ } + case '<': + commit ("《"); return TRUE; + case '>': +@@ -144,13 +152,21 @@ FallbackEditor::processPunctForTraditionalChinese (guint keyval, guint keycode, + m_double_quote = !m_double_quote; + return TRUE; + case ',': +- commit (","); return TRUE; ++ if (m_prev_committed_char >= '0' && m_prev_committed_char <= '9') { ++ m_prev_committed_char = keyval; ++ return FALSE; ++ } else { ++ commit (","); ++ return TRUE; ++ } + case '.': +- if (m_prev_committed_char >= '0' && m_prev_committed_char <= '9') ++ if (m_prev_committed_char >= '0' && m_prev_committed_char <= '9') { ++ m_prev_committed_char = keyval; + return FALSE; +- else ++ } else { + commit ("。"); +- return TRUE; ++ return TRUE; ++ } + case '<': + commit ("《"); return TRUE; + case '>': +-- +2.26.2 + diff --git a/SPECS/ibus-libpinyin.spec b/SPECS/ibus-libpinyin.spec index f114248..628a3c4 100644 --- a/SPECS/ibus-libpinyin.spec +++ b/SPECS/ibus-libpinyin.spec @@ -2,7 +2,7 @@ Name: ibus-libpinyin Version: 1.10.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Intelligent Pinyin engine based on libpinyin for IBus License: GPLv2+ Group: System Environment/Libraries @@ -11,6 +11,7 @@ Source0: http://downloads.sourceforge.net/libpinyin/ibus-libpinyin/%{name}-%{ %if %snapshot Patch0: ibus-libpinyin-1.10.x-head.patch %endif +Patch1: ibus-libpinyin-fixes-period-and-comma-handling.patch Requires: python3-gobject Requires: ibus >= 1.5.11 @@ -42,6 +43,7 @@ input method based on libpinyin for IBus. %if %snapshot %patch0 -p1 -b .head %endif +%patch1 -p1 -b .period %build %configure --disable-static \ @@ -87,6 +89,10 @@ make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p" %{_datadir}/ibus/component/* %changelog +* Tue Oct 27 2020 Peng Wu - 1.10.0-2 +- Fixes period and comma handling +- Resolves: #1857750 + * Tue Apr 17 2018 Peng Wu - 1.10.0-1 - Update to 1.10.0 - bug fixes