[ibus-indic-table/f15] fixed bug 683826-683743

anish anishpatil at fedoraproject.org
Tue Sep 27 05:29:52 UTC 2011


commit a8cd15b4e1364d2fccddc25636f79baf9c75c657
Author: anish <anish at dhcp193-44.pnq.redhat.com>
Date:   Tue Sep 27 11:00:33 2011 +0530

    fixed bug 683826-683743

 bug-683826-683743.patch |  134 +++++++++++++++++++++++++++++++++++++++++++++++
 ibus-indic-table.spec   |    7 ++-
 2 files changed, 140 insertions(+), 1 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)
+         
diff --git a/ibus-indic-table.spec b/ibus-indic-table.spec
index 1dd9917..3d92084 100644
--- a/ibus-indic-table.spec
+++ b/ibus-indic-table.spec
@@ -1,6 +1,6 @@
 Name:       ibus-indic-table
 Version:    1.3.1
-Release:    3%{?dist}
+Release:    4%{?dist}
 Summary:    The Table engine for IBus platform
 License:    LGPLv2+
 Group:      System Environment/Libraries
@@ -8,6 +8,7 @@ URL:        http://code.google.com/p/ibus/
 Source0:    http://fedorapeople.org/~nkumar/ibus-indic-table/ibus-indic-table-1.3.1/%{name}-%{version}.tar.gz
 Patch0:	    i-i-t-683739.patch
 Patch1:	    bug-703124.patch
+Patch2:     bug-683826-683743.patch
 Requires:       ibus
 BuildRequires:  ibus-devel
 BuildArch:  noarch
@@ -19,6 +20,7 @@ The Indic Table engine for IBus platform.
 %setup -q
 %patch0 -p1
 %patch1 -p1 -b .2-reduced-limit-for-query
+%patch2 -p1
 
 %build
 %configure --disable-static --disable-additional
@@ -39,6 +41,9 @@ make DESTDIR=${RPM_BUILD_ROOT} NO_INDEX=true install pkgconfigdir=%{_datadir}/pk
 %{_datadir}/pkgconfig/%{name}.pc
 
 %changelog
+* Wed Sep 27 2011 Anish Patil <apatil at redhat.com> - 1.3.1-4
+- reolves bug #683826 and #683743
+
 * Mon May 09 2011 Pravin Satpute <psatpute at redhat.com> - 1.3.1-3
 - reolves bug #703124
 


More information about the scm-commits mailing list