ibus-libpinyin/ibus-libpinyin-fixes-period-and-comma-handling.patch

159 lines
4.9 KiB
Diff
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From 1eb70ce12bed9d6b53c02ac8693ec52abe1d0216 Mon Sep 17 00:00:00 2001
From: Peng Wu <pwu@redhat.com>
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 <pwu@redhat.com>
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 <pwu@redhat.com>
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