summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPeng Huang <shawn.p.huang@gmail.com>2010-04-24 15:31:13 +0800
committerPeng Huang <shawn.p.huang@gmail.com>2010-04-24 15:31:13 +0800
commitc9d7cd3ce501e7134692c51b3ba42e2eb079b312 (patch)
tree69d1262d03269153c0dfb6835a5f78ac3663ae45 /src
parent0bb27ab4b07716102e7c86c103a88476e74335f1 (diff)
downloadibus-libpinyin-c9d7cd3ce501e7134692c51b3ba42e2eb079b312.tar.gz
ibus-libpinyin-c9d7cd3ce501e7134692c51b3ba42e2eb079b312.tar.xz
ibus-libpinyin-c9d7cd3ce501e7134692c51b3ba42e2eb079b312.zip
Fix half and full punch problem
Diffstat (limited to 'src')
-rw-r--r--src/FallbackEditor.cc4
-rw-r--r--src/FallbackEditor.h11
-rw-r--r--src/PinyinEngine.cc4
-rw-r--r--src/Text.h4
4 files changed, 16 insertions, 7 deletions
diff --git a/src/FallbackEditor.cc b/src/FallbackEditor.cc
index e530539..2ea7a79 100644
--- a/src/FallbackEditor.cc
+++ b/src/FallbackEditor.cc
@@ -89,7 +89,7 @@ FallbackEditor::processPunct (guint keyval, guint keycode, guint modifiers)
case ',':
commit (","); return TRUE;
case '.':
- if (m_prev_commited_char >= '0' && m_prev_commited_char <= '9')
+ if (m_prev_committed_char >= '0' && m_prev_committed_char <= '9')
commit (keyval);
else
commit ("。");
@@ -183,7 +183,7 @@ void
FallbackEditor::reset (void) {
m_quote = TRUE;
m_double_quote = TRUE;
- m_prev_commited_char = 0;
+ m_prev_committed_char = 0;
}
diff --git a/src/FallbackEditor.h b/src/FallbackEditor.h
index 799740f..de2a691 100644
--- a/src/FallbackEditor.h
+++ b/src/FallbackEditor.h
@@ -13,29 +13,30 @@ public:
: Editor (props),
m_quote (TRUE),
m_double_quote (TRUE),
- m_prev_commited_char (0) {}
+ m_prev_committed_char (0) {}
gboolean processKeyEvent (guint keyval, guint keycode, guint modifiers);
void reset (void);
+ void setPrevCommittedChar (gunichar ch) {
+ m_prev_committed_char = ch;
+ }
+
private:
void commit (gchar ch) {
gchar str[2] = {ch, 0};
StaticText text (str);
commitText (text);
- m_prev_commited_char = ch;
}
void commit (gunichar ch) {
Text text (ch);
commitText (text);
- m_prev_commited_char = ch;
}
void commit (const gchar *str) {
StaticText text (str);
commitText (text);
- m_prev_commited_char = 0;
}
void commit (const String &str) {
@@ -47,7 +48,7 @@ private:
private:
gboolean m_quote;
gboolean m_double_quote;
- gunichar m_prev_commited_char;
+ gunichar m_prev_committed_char;
};
diff --git a/src/PinyinEngine.cc b/src/PinyinEngine.cc
index 149d935..1d39e2c 100644
--- a/src/PinyinEngine.cc
+++ b/src/PinyinEngine.cc
@@ -198,6 +198,10 @@ PinyinEngine::slotCommitText (Text & text)
ibus_engine_commit_text (m_engine, text);
if (m_input_mode != MODE_INIT)
m_input_mode = MODE_INIT;
+ if (text.text ())
+ static_cast<FallbackEditor*> (m_fallback_editor.get ())->setPrevCommittedChar (*text.text ());
+ else
+ static_cast<FallbackEditor*> (m_fallback_editor.get ())->setPrevCommittedChar (0);
}
void
diff --git a/src/Text.h b/src/Text.h
index ae98814..b378918 100644
--- a/src/Text.h
+++ b/src/Text.h
@@ -24,6 +24,10 @@ public:
ibus_text_append_attribute (get<IBusText> (), type, value, start, end);
}
+ const gchar *text (void) const {
+ return get<IBusText> ()->text;
+ }
+
operator IBusText * (void) const {
return get<IBusText> ();
}