[ibus-indic-table/f16] Resolved the bug-683826-683743.patch
anish
anishpatil at fedoraproject.org
Thu Sep 22 05:02:22 UTC 2011
commit 0fd77046498ad2cb9986f7ac760c853676739763
Author: anish <anish at dhcp193-44.pnq.redhat.com>
Date: Thu Sep 22 10:30:37 2011 +0530
Resolved the bug-683826-683743.patch
bug-683826-683743.patch | 134 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 134 insertions(+), 0 deletions(-)
---
diff --git a/bug-683826-683743.patch b/bug-683826-683743.patch
new file mode 100644
index 0000000..f0e375a
--- /dev/null
+++ b/bug-683826-683743.patch
@@ -0,0 +1,134 @@
+diff -rup ibus-indic-table-1.3.1-org//engine/indic_table.py ibus-indic-table-1.3.1/engine/indic_table.py
+--- ibus-indic-table-1.3.1-org//engine/indic_table.py 2011-09-15 12:09:48.799618693 +0530
++++ ibus-indic-table-1.3.1/engine/indic_table.py 2011-09-15 14:46:42.126833474 +0530
+@@ -93,6 +93,8 @@ class editor(object):
+ self._caret = 0
+ # self._onechar: whether we only select single character
+ self._onechar = self._config.get_value (self._config_section, "OneChar", False)
++ # list used to keep chars when shift key is been pressed
++ self._k_list = []
+ # self._chinese_mode: the candidate filter mode,
+ # 0 is simplify Chinese
+ # 1 is traditional Chinese
+@@ -737,6 +739,9 @@ class editor(object):
+
+ def backspace (self):
+ '''Process backspace Key Event'''
++ if self._k_list:
++ self._k_list.pop()
++
+ self._zi = u''
+ if self.get_input_chars():
+ self.pop_input ()
+@@ -784,6 +789,7 @@ class editor(object):
+ def l_shift (self):
+ '''Process Left Shift Key Event as immediately commit to preedit strings'''
+ if self._chars[0]:
++ self._k_list.extend( self._tabkey_list)
+ self.commit_to_preedit ()
+ return True
+ else:
+@@ -836,11 +842,17 @@ class tabengine (ibus.EngineBase):
+ def __init__ (self, bus, obj_path, db ):
+ super(tabengine,self).__init__ (bus,obj_path)
+ self._bus = bus
++ self.db = db
++
++ tabengine._page_size = int(self.db.get_ime_property('page_size'))
++ if tabengine._page_size > 15:
++ tabengine._page_size = 6
++
+ self._lookup_table = ibus.LookupTable (tabengine._page_size)
+ # this is the backend sql db we need for our IME
+ # we receive this db from IMEngineFactory
+ #self.db = tabsqlitedb.tabsqlitedb( name = dbname )
+- self.db = db
++
+ # this is the parer which parse the input string to key object
+ self._parser = tabdict.parse
+
+@@ -1443,7 +1455,13 @@ class tabengine (ibus.EngineBase):
+ if sp_res[0]:
+ self.commit_string (sp_res[1])
+ #self.add_string_len(sp_res[1])
+- self.db.check_phrase (sp_res[1], sp_res[2])
++ alphabates = [ self._editor._deparser(item) for item in self._editor._k_list ]
++ if sp_res[2]:
++ alphabates.extend(sp_res[2])
++ str_alphabates = ''.join(alphabates)
++ self.db.check_phrase (sp_res[1], str_alphabates)
++ self._editor._k_list=[]
++ # self.db.check_phrase (sp_res[1], sp_res[2])
+ else:
+ if sp_res[1] == u' ':
+ self.commit_string (cond_letter_translate (u" "))
+diff -rup ibus-indic-table-1.3.1-org//engine/tabsqlitedb.py ibus-indic-table-1.3.1/engine/tabsqlitedb.py
+--- ibus-indic-table-1.3.1-org//engine/tabsqlitedb.py 2011-09-15 12:09:48.796618693 +0530
++++ ibus-indic-table-1.3.1/engine/tabsqlitedb.py 2011-09-15 14:47:01.920833934 +0530
+@@ -104,10 +104,11 @@ class tabsqlitedb:
+ 'rules':'',
+ #'rules':'ce2:p11+p12+p21+p22;ce3:p11+p21+p22+p31;ca4:p11+p21+p31+p41'}
+ 'least_commit_length':'0',
+- 'start_chars':''
++ 'start_chars':'',
+ # we use this entry for those IME, which don't
+ # have rules to build up phrase, but still need
+ # auto commit to preedit
++ 'page_size':'6'
+ }
+ # inital the attribute in ime table, which should be updated from mabiao
+ for _name in ime_keys:
+@@ -678,7 +679,7 @@ class tabsqlitedb:
+ SELECT * FROM user_db.phrases WHERE mlen < %(mk)d %(condition)s
+ UNION ALL
+ SELECT * FROM mudb.phrases WHERE mlen < %(mk)d %(condition)s )
+- ORDER BY user_freq DESC, freq DESC, id ASC, mlen ASC limit 42;''' % { 'mk':_len+x_len, 'condition':_condition}
++ ORDER BY user_freq DESC, freq DESC, id ASC, mlen ASC limit 100;''' % { 'mk':_len+x_len, 'condition':_condition}
+ # we have redefine the __int__(self) in class tabdict.tab_key to return the key id, so we can use map to got key id :)
+ _tabkeys = map(int,tabkeys[:_len])
+ _tabkeys += _tabkeys + _tabkeys
+@@ -881,21 +882,21 @@ class tabsqlitedb:
+ return []
+ #print p_len
+ try:
+- if p_len >= self.rules['above']:
+- rule = self.rules[ self.rules['above'] ]
+- elif p_len in self.rules:
+- rule = self.rules[p_len]
+- else:
+- raise Exception ('unsupport len of phrase')
+- if len(rule) > self._mlen:
+- raise Exception ('fault rule: %s' % rule)
++# if p_len >= self.rules['above']:
++# rule = self.rules[ self.rules['above'] ]
++# elif p_len in self.rules:
++# rule = self.rules[p_len]
++# else:
++# raise Exception ('unsupport len of phrase')
++# if len(rule) > self._mlen:
++# raise Exception ('fault rule: %s' % rule)
+ #for (zi,ma) in rule:
+ # if zi > 0:
+ # zi -= 1
+ # gcm = self.get_gcm_id (phrase[zi])
+ # tabkeylist.append(gcm[ma-1])
+- tabkeylist = map (lambda x: self.get_gcm_id ( phrase[x[0]-1 if x[0] > 0 else x[0]] )\
+- [ x[1]-1 if x[1] > 0 else x[1] ], rule )
++# tabkeylist = map (lambda x: self.get_gcm_id ( phrase[x[0]-1 if x[0] > 0 else x[0]] )\
++# [ x[1]-1 if x[1] > 0 else x[1] ], rule )
+ return [len( tabkeylist)] + [p_len] + tabkeylist[:] + [phrase]
+
+ except:
+@@ -992,9 +993,9 @@ class tabsqlitedb:
+ map (lambda x: mudb.update(x[2]), reslist)
+ #print "mudb is ", mudb
+
+- tabkey = ''
+- if len(phrase) >=2:
+- tabkey = u''.join ( map(self.deparse,wordattr[2:2+_len]) )
++# tabkey = ''
++# if len(phrase) >=2:
++# tabkey = u''.join ( map(self.deparse,wordattr[2:2+_len]) )
+ #for k in wordattr[2:2+_len]:
+ # tabkey += self.deparse (k)
+
More information about the scm-commits
mailing list