My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions

Issue 726 attachment: patch-autocomm (2.4 KB)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
--- table.py.orig 2010-01-05 19:11:20.000000000 +0800
+++ table.py 2010-01-05 20:51:18.000000000 +0800
@@ -172,7 +172,7 @@
self.clear ()
self._parser = parser

- def add_input (self,c):
+ def add_input (self, tabeng, c):
'''add input character'''
if len (self._t_chars) == self._max_length:
return True
@@ -181,7 +181,7 @@
self.split_phrase()
if (len (self._chars[0]) == self._max_key_len and (not self._py_mode)) or ( len (self._chars[0]) == 7 and self._py_mode ) :
self.auto_commit_to_preedit()
- res = self.add_input (c)
+ res = self.add_input (None, c)
return res
elif self._chars[1]:
self._chars[1].append (c)
@@ -189,7 +189,18 @@
if (not self._py_mode and ( c in self._valid_input_chars)) or\
(self._py_mode and (c in u'abcdefghijklmnopqrstuvwxyz!@#$%')):
try:
- self._tabkey_list += self._parser (c)
+ _c = self._parser (c)
+ _tabkey_list = self._tabkey_list + _c
+ if tabeng != None and tabeng._auto_commit:
+ _candidates = self.db.select_words(\
+ _tabkey_list, self._onechar )
+ if len (_candidates) == 0:
+ sp_res = self.space ()
+ if sp_res[0]:
+ tabeng.commit_string (sp_res[1])
+ res = self.add_input (None, c)
+ return res
+ self._tabkey_list = _tabkey_list
self._chars[0].append (c)
except:
self._chars[1].append (c)
@@ -584,7 +595,7 @@
self._candidates[1] = []
last_input = self.pop_input ()
self.auto_commit_to_preedit ()
- res = self.add_input( last_input )
+ res = self.add_input( None, last_input )
return res
else:
self.pop_input ()
@@ -1471,7 +1482,7 @@
#self.add_string_len(sp_res[1])
self.db.check_phrase (sp_res[1],sp_res[2])

- res = self._editor.add_input ( unichr(key.code) )
+ res = self._editor.add_input ( self, unichr(key.code) )
if not res:
if ascii.ispunct (key.code):
key_char = cond_punct_translate (unichr (key.code))
Powered by Google Project Hosting