summaryrefslogtreecommitdiff
path: root/src/PyZyDoublePinyinContext.cc
diff options
context:
space:
mode:
authorHiroshi Sumita <hsumita@chromium.org>2012-06-07 11:26:19 +0900
committerHiroshi Sumita <hsumita@chromium.org>2012-06-07 11:26:19 +0900
commit0576f6090561dfdd4281d89e971dc9384faad0b1 (patch)
treef577c4e9e706d28d406c793b83321227b3010e9d /src/PyZyDoublePinyinContext.cc
parentad58ca3fb07c35eedcaf2edc2e9e7f19c8b46138 (diff)
downloadpyzy-0576f6090561dfdd4281d89e971dc9384faad0b1.tar.gz
Implements InputContext::Observer::updateInputText and updateCursor
BUG=None TEST=Manual Review URL: https://codereview.appspot.com/6298043
Diffstat (limited to 'src/PyZyDoublePinyinContext.cc')
-rw-r--r--src/PyZyDoublePinyinContext.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/PyZyDoublePinyinContext.cc b/src/PyZyDoublePinyinContext.cc
index 7788f75..7a7372a 100644
--- a/src/PyZyDoublePinyinContext.cc
+++ b/src/PyZyDoublePinyinContext.cc
@@ -81,6 +81,8 @@ DoublePinyinContext::insert (char ch)
return false;
}
else {
+ updateInputText ();
+ updateCursor ();
if (updateSpecialPhrases ()) {
update ();
}
@@ -92,6 +94,8 @@ DoublePinyinContext::insert (char ch)
}
}
else {
+ updateInputText ();
+ updateCursor ();
updateSpecialPhrases ();
updatePhraseEditor ();
update ();
@@ -107,6 +111,8 @@ DoublePinyinContext::removeCharBefore (void)
m_cursor --;
m_text.erase (m_cursor, 1);
+ updateInputText ();
+ updateCursor ();
if (updatePinyin (false)) {
updateSpecialPhrases ();
@@ -132,6 +138,8 @@ DoublePinyinContext::removeCharAfter (void)
return false;
m_text.erase (m_cursor, 1);
+ updateInputText ();
+
if (updateSpecialPhrases ()) {
update ();
}
@@ -151,6 +159,8 @@ DoublePinyinContext::removeWordBefore (void)
if (G_UNLIKELY (m_cursor > m_pinyin_len)) {
m_text.erase (m_pinyin_len, m_cursor - m_pinyin_len);
m_cursor = m_pinyin_len;
+ updateInputText ();
+ updateCursor ();
if (updateSpecialPhrases ()) {
update ();
}
@@ -164,6 +174,8 @@ DoublePinyinContext::removeWordBefore (void)
m_pinyin.pop_back ();
m_text.erase (m_pinyin_len, m_cursor - m_pinyin_len);
m_cursor = m_pinyin_len;
+ updateInputText ();
+ updateCursor ();
updateSpecialPhrases ();
updatePhraseEditor ();
update ();
@@ -179,6 +191,8 @@ DoublePinyinContext::removeWordAfter (void)
return false;
m_text.erase (m_cursor);
+ updateInputText ();
+
if (updateSpecialPhrases ()) {
update ();
}
@@ -196,6 +210,7 @@ DoublePinyinContext::moveCursorLeft (void)
return false;
m_cursor --;
+ updateCursor ();
if (m_cursor >= m_pinyin_len) {
if (updateSpecialPhrases ()) {
@@ -233,6 +248,7 @@ DoublePinyinContext::moveCursorRight (void)
return false;
m_cursor ++;
+ updateCursor ();
if (updatePinyin (false)) {
updateSpecialPhrases ();
updatePhraseEditor ();
@@ -258,6 +274,7 @@ DoublePinyinContext::moveCursorLeftByWord (void)
if (G_UNLIKELY (m_cursor > m_pinyin_len)) {
m_cursor = m_pinyin_len;
+ updateCursor ();
if (updateSpecialPhrases ()) {
update ();
}
@@ -269,6 +286,7 @@ DoublePinyinContext::moveCursorLeftByWord (void)
else {
m_cursor = m_pinyin_len = m_pinyin.back ().begin;
m_pinyin.pop_back ();
+ updateCursor ();
updateSpecialPhrases ();
updatePhraseEditor ();
update ();
@@ -292,6 +310,7 @@ DoublePinyinContext::moveCursorToBegin (void)
m_cursor = 0;
m_pinyin.clear ();
m_pinyin_len = 0;
+ updateCursor ();
updateSpecialPhrases ();
updatePhraseEditor ();
update ();
@@ -306,6 +325,8 @@ DoublePinyinContext::moveCursorToEnd (void)
return false;
m_cursor = m_text.length ();
+ updateCursor ();
+
if (updatePinyin (false)) {
updateSpecialPhrases ();
updatePhraseEditor ();