Repository : http://git.fedorahosted.org/git/?p=ibus-typing-booster.git
On branch : master
>---------------------------------------------------------------
commit 9e3c953efe975289e2ea9a9db4b5a7aa00833c10
Author: Mike FABIAN <mfabian(a)redhat.com>
Date: Tue Dec 15 13:29:35 2015 +0100
Don���t use MOD1 (left Alt key) to select a candidate to delete anymore
The left Alt key will be needed for input for some input methods.
For example, ta-lk-renganathan.mim has stuff like:
((A-4) "���")
>---------------------------------------------------------------
ibus-typing-booster/engine/hunspell_table.py | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/ibus-typing-booster/engine/hunspell_table.py b/ibus-typing-booster/engine/hunspell_table.py
index 2924ba4..a77321f 100644
--- a/ibus-typing-booster/engine/hunspell_table.py
+++ b/ibus-typing-booster/engine/hunspell_table.py
@@ -941,9 +941,7 @@ class tabengine (IBus.Engine):
self._update_ui()
return True
if (key.val >= 32
- and (not (key.state & (
- IBus.ModifierType.MOD1_MASK
- | IBus.ModifierType.CONTROL_MASK)))):
+ and (not (key.state & IBus.ModifierType.CONTROL_MASK))):
typed_character = IBus.keyval_to_unicode(key.val)
# If the first character typed is a character which is
# very unlikely to be part of a word
@@ -1061,8 +1059,7 @@ class tabengine (IBus.Engine):
if key.val >= IBus.KEY_F1 and key.val <= IBus.KEY_F9:
index = key.val - IBus.KEY_F1
if index >= 0 and index < self._page_size:
- if (key.state & IBus.ModifierType.CONTROL_MASK
- or key.state & IBus.ModifierType.MOD1_MASK):
+ if (key.state & IBus.ModifierType.CONTROL_MASK):
# Remove the candidate from the user database
res = self._editor.remove_candidate_from_user_database(
index)
Repository : http://git.fedorahosted.org/git/?p=ibus-typing-booster.git
On branch : master
>---------------------------------------------------------------
commit ceb43832949d6951b887c0e1cf0becbcde8e49c5
Author: Mike FABIAN <mfabian(a)redhat.com>
Date: Mon Dec 14 18:15:24 2015 +0100
Improve code to select candidates to commit or to remove
Until now only the keys 1-9 were used to select a candidate to commit
or to remove (There was a bug that for candidate lists which showed
fewer than 9 entries, the number keys higher than the number of
candidates shown selected a hidden candidate from the next page of
candidates, this commit fixes this bug as well).
Now the keys F1-F9 are also used to select a candidate to commit or
to remove as well. This is needed because the keys 1-9 are
used as valid input in some input methods.
And the KP_1-KP_9 (number keys on the keypad) are also used
to select a candidate to commit or to remove.
>---------------------------------------------------------------
ibus-typing-booster/engine/hunspell_table.py | 56 +++++++++++++------------
1 files changed, 29 insertions(+), 27 deletions(-)
diff --git a/ibus-typing-booster/engine/hunspell_table.py b/ibus-typing-booster/engine/hunspell_table.py
index bba3d13..4e470f4 100644
--- a/ibus-typing-booster/engine/hunspell_table.py
+++ b/ibus-typing-booster/engine/hunspell_table.py
@@ -466,8 +466,9 @@ class editor(object):
return u''
return self._candidates[index][0]
- def alt_number (self, index):
- '''Remove the phrase selected with Alt+Number from the user database.
+ def remove_candidate_from_user_database (self, index):
+ '''Remove the candidate shown at index in the candidate list
+ from the user database.
The index parameter should start from 0.
@@ -487,7 +488,7 @@ class editor(object):
system phrase from the user database resets its user frequency
to 0 again.
- So the user can always type Alt+Number on a phrase he does not
+ So the user can always try to delete a phrase if he does not
want the phrase to be suggested wich such a high priority, no
matter whether it is a system phrase or a user defined phrase.
'''
@@ -1087,30 +1088,31 @@ class tabengine (IBus.Engine):
self._update_ui()
return True
- if (key.val >= IBus.KEY_1
- and key.val <= IBus.KEY_9
- and self._editor.get_candidates()
- and key.state & IBus.ModifierType.CONTROL_MASK):
- res = self._editor.alt_number (key.val - IBus.KEY_1)
- self._update_ui ()
- return res
-
- if (key.val >= IBus.KEY_1
- and key.val <= IBus.KEY_9
- and self._editor.get_candidates()
- and key.state & IBus.ModifierType.MOD1_MASK):
- res = self._editor.alt_number (key.val - IBus.KEY_1)
- self._update_ui ()
- return res
-
- if (key.val >= IBus.KEY_1
- and key.val <= IBus.KEY_9
- and self._editor.get_candidates()):
- phrase = self._editor.get_string_from_lookup_table_current_page(
- key.val - IBus.KEY_1)
- if phrase:
- self.commit_string(phrase + u' ')
- return True
+ # Commit or remove a candidate:
+ if self._editor.get_candidates():
+ index = -1
+ if key.val >= IBus.KEY_1 and key.val <= IBus.KEY_9:
+ index = key.val - IBus.KEY_1
+ if key.val >= IBus.KEY_KP_1 and key.val <= IBus.KEY_KP_9:
+ index = key.val - IBus.KEY_KP_1
+ if key.val >= IBus.KEY_F1 and key.val <= IBus.KEY_F9:
+ index = key.val - IBus.KEY_F1
+ if index >= 0 and index < self._page_size:
+ if (key.state & IBus.ModifierType.CONTROL_MASK
+ or key.state & IBus.ModifierType.MOD1_MASK):
+ # Remove the candidate from the user database
+ res = self._editor.remove_candidate_from_user_database(
+ index)
+ self._update_ui()
+ return res
+ else:
+ # Commit a candidate:
+ phrase = (
+ self._editor.get_string_from_lookup_table_current_page(
+ index))
+ if phrase:
+ self.commit_string(phrase + u' ')
+ return True
if key.val == IBus.KEY_Tab:
if self._tab_enable:
Repository : http://git.fedorahosted.org/git/?p=ibus-typing-booster.git
On branch : master
>---------------------------------------------------------------
commit 7ad1d56a46f9b85eaa4345db70cf0c506604a8b0
Author: Mike FABIAN <mfabian(a)redhat.com>
Date: Mon Dec 14 17:25:59 2015 +0100
Add some comments
>---------------------------------------------------------------
ibus-typing-booster/engine/hunspell_table.py | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/ibus-typing-booster/engine/hunspell_table.py b/ibus-typing-booster/engine/hunspell_table.py
index d1003d4..121b944 100644
--- a/ibus-typing-booster/engine/hunspell_table.py
+++ b/ibus-typing-booster/engine/hunspell_table.py
@@ -1139,6 +1139,7 @@ class tabengine (IBus.Engine):
return True
return True
+ # These keys may trigger a commit:
if key.val in (IBus.KEY_Return, IBus.KEY_KP_Enter, IBus.KEY_space,
IBus.KEY_Right, IBus.KEY_KP_Right,
IBus.KEY_Left, IBus.KEY_KP_Left):
@@ -1229,6 +1230,14 @@ class tabengine (IBus.Engine):
self._update_ui()
return True
+ # What kind of key was this??
+ #
+ # keychar = IBus.keyval_to_unicode(key.val)
+ #
+ # returned no result. And apparently it was not handled as
+ # a select key or other special key either.
+ # So whatever this was, we cannot handle it,
+ # just pass it through to the application by returning ���False���.
return False
def do_focus_in (self):