Repository : http://git.fedorahosted.org/git/?p=ibus-typing-booster.git
On branch : master
>---------------------------------------------------------------
commit a9a1122bb32b361818fbc2fd800306894d0560f2
Author: Mike FABIAN <mfabian(a)redhat.com>
Date: Thu Dec 17 11:04:37 2015 +0100
Fix typo in doc string
>---------------------------------------------------------------
ibus-typing-booster/engine/m17n_translit.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/ibus-typing-booster/engine/m17n_translit.py b/ibus-typing-booster/engine/m17n_translit.py
index c1de137..9981372 100644
--- a/ibus-typing-booster/engine/m17n_translit.py
+++ b/ibus-typing-booster/engine/m17n_translit.py
@@ -210,7 +210,7 @@ class Transliterator:
'gr��n'
If initializing the transliterator fails, for example
- because a non-existing input method was give as the argument,
+ because a non-existing input method was given as the argument,
a ValueError is raised:
>>> trans = Transliterator('ru-translitx')
Repository : http://git.fedorahosted.org/git/?p=ibus-typing-booster.git
On branch : master
>---------------------------------------------------------------
commit 7630d6ca3754f375bd96ddbe627c3b3351020f91
Author: Mike FABIAN <mfabian(a)redhat.com>
Date: Tue Dec 15 22:58:48 2015 +0100
Release 1.3.0
>---------------------------------------------------------------
ibus-typing-booster/ChangeLog | 11 +++++++++++
ibus-typing-booster/configure.ac | 4 ++--
ibus-typing-booster/ibus-typing-booster.pc.in | 2 +-
3 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/ibus-typing-booster/ChangeLog b/ibus-typing-booster/ChangeLog
index 61bce35..802932d 100644
--- a/ibus-typing-booster/ChangeLog
+++ b/ibus-typing-booster/ChangeLog
@@ -1,4 +1,15 @@
* Author: Mike FABIAN <mfabian(a)redhat.com>
+* 15 Dez 2015 Released 1.3.0 version
+* Use libm17n directly instead of going through libtranslit
+* Forward key events triggering a commit using ���forward_key_event()��� instead of relying on ���return False��� (Resolves: rhbz#1291238)
+* Add code to use F1-F9 as well as keys to select candidates for commit or remove
+* Don���t commit invisible candidates with select keys with numbers greater than the length of a page of the candidate list
+* Control-arrow-left and Control-arrow-right now commit when the edges of the pre��dit string are reached
+* Alt-<number> does not delete a prediction anymore, now only Control-<number> does this
+* Add an option to disable the use of the digits 1-9 as selection keys (useful if one wants easier number input, selection then works only with the F1-F9 keys)
+* Support input methods using AltGr (e.g. mr-inscript2) and Alt keys (e.g. ta-lk-renganathan) (Resolves: rhbz#1051405, rhbz#772665)
+
+* Author: Mike FABIAN <mfabian(a)redhat.com>
* 02 Nov 2015 Released 1.2.15 version
* Use open() instead of codecs.open() to make the input method help button work again (Resolves: rhbz#1276992)
* Fix some pylint warnings
diff --git a/ibus-typing-booster/configure.ac b/ibus-typing-booster/configure.ac
index 2627871..0eb942e 100755
--- a/ibus-typing-booster/configure.ac
+++ b/ibus-typing-booster/configure.ac
@@ -23,8 +23,8 @@
m4_define([package_name], [ibus-typing-booster])
m4_define([ibus_released], [1])
m4_define([ibus_major_version], [1])
-m4_define([ibus_minor_version], [2])
-m4_define([ibus_micro_version], [15])
+m4_define([ibus_minor_version], [3])
+m4_define([ibus_micro_version], [0])
m4_define(ibus_maybe_datestamp,
m4_esyscmd([if test x]ibus_released[ != x1; then date +.%Y%m%d | tr -d '\n\r'; fi]))
diff --git a/ibus-typing-booster/ibus-typing-booster.pc.in b/ibus-typing-booster/ibus-typing-booster.pc.in
index 3999933..e2335a5 100755
--- a/ibus-typing-booster/ibus-typing-booster.pc.in
+++ b/ibus-typing-booster/ibus-typing-booster.pc.in
@@ -11,7 +11,7 @@ enginedir=/usr/share/ibus/engine
Name: IBus-Typing-Booster
Description: Table Based Input Method Framework for Intelligent Input Bus for Linux / Unix OS
-Version: 1.2.15
+Version: 1.3.0
Requires:
Libs:
Cflags:
Repository : http://git.fedorahosted.org/git/?p=ibus-typing-booster.git
On branch : master
>---------------------------------------------------------------
commit 26c36bf4438c6b29b66a84a3743ef23dc90fa069
Author: Mike FABIAN <mfabian(a)redhat.com>
Date: Tue Dec 15 11:27:02 2015 +0100
Improve code to handle the left and right arrow keys
Control-arrow-left and control-arrow-right should also commit when the
end of the pre��dit string is reached, otherwise this is inconsistent
with the behaviour of arrow-left and arrow-right, I think.
I.e. now the first Control-arrow-left moves the cursor to the left of the
pre��dit, another Control-arrow-left commits and sends a Control-arrow-left
to the application.
>---------------------------------------------------------------
ibus-typing-booster/engine/hunspell_table.py | 74 ++++++++++---------------
1 files changed, 30 insertions(+), 44 deletions(-)
diff --git a/ibus-typing-booster/engine/hunspell_table.py b/ibus-typing-booster/engine/hunspell_table.py
index a876265..6242b58 100644
--- a/ibus-typing-booster/engine/hunspell_table.py
+++ b/ibus-typing-booster/engine/hunspell_table.py
@@ -295,18 +295,6 @@ class editor(object):
'NFC', transliterated_string_up_to_cursor)
return len(transliterated_string_up_to_cursor)
- def control_arrow_left (self):
- '''
- Move cursor to the beginning of the typed string
- '''
- self._typed_string_cursor = 0
-
- def control_arrow_right (self):
- '''
- Move cursor to the end of the typed string
- '''
- self._typed_string_cursor = len(self._typed_string)
-
def append_candidate_to_lookup_table(self, phrase=u'', user_freq=0):
'''append candidate to lookup_table'''
if not phrase:
@@ -1050,22 +1038,6 @@ class tabengine (IBus.Engine):
self._update_ui ()
return res
- if (key.val in (IBus.KEY_Left, IBus.KEY_KP_Left)
- and key.state & IBus.ModifierType.CONTROL_MASK):
- if self._editor.is_empty():
- return False
- self._editor.control_arrow_left()
- self._update_ui()
- return True
-
- if (key.val in (IBus.KEY_Right, IBus.KEY_KP_Right)
- and key.state & IBus.ModifierType.CONTROL_MASK):
- if self._editor.is_empty():
- return False
- self._editor.control_arrow_right()
- self._update_ui()
- return True
-
if (key.val == IBus.KEY_BackSpace
and key.state & IBus.ModifierType.CONTROL_MASK):
if self._editor.is_empty():
@@ -1155,17 +1127,26 @@ class tabengine (IBus.Engine):
IBus.KEY_Left, IBus.KEY_KP_Left):
if self._editor.is_empty():
return False
- if key.val in (IBus.KEY_Right, IBus.KEY_KP_Right):
- if (self._editor._typed_string_cursor
- < len(self._editor._typed_string)):
+ if (key.val in (IBus.KEY_Right, IBus.KEY_KP_Right)
+ and (self._editor._typed_string_cursor
+ < len(self._editor._typed_string))):
+ if key.state & IBus.ModifierType.CONTROL_MASK:
+ # Move cursor to the end of the typed string
+ self._editor._typed_string_cursor = len(
+ self._editor._typed_string)
+ else:
self._editor._typed_string_cursor += 1
- self._update_ui()
- return True
- if key.val in (IBus.KEY_Left, IBus.KEY_KP_Left):
- if self._editor._typed_string_cursor > 0:
+ self._update_ui()
+ return True
+ if (key.val in (IBus.KEY_Left, IBus.KEY_KP_Left)
+ and self._editor._typed_string_cursor > 0):
+ if key.state & IBus.ModifierType.CONTROL_MASK:
+ # Move cursor to the beginning of the typed string
+ self._editor._typed_string_cursor = 0
+ else:
self._editor._typed_string_cursor -= 1
- self._update_ui()
- return True
+ self._update_ui()
+ return True
input_phrase = self._editor.get_transliterated_string()
if not input_phrase:
return False
@@ -1187,14 +1168,19 @@ class tabengine (IBus.Engine):
if key.val in (IBus.KEY_Left, IBus.KEY_KP_Left):
# After committing, the cursor is at the right side of
# the committed string. When the string has been
- # committed because of arrow-left, the cursor has
- # to be moved to the left side of the string. This
- # should be done in a way which works even when
- # surrounding text is not supported. We can do it by
- # forwarding as many arrow-left events to the application
- # as the committed string has characters:
+ # committed because of arrow-left or
+ # control-arrow-left, the cursor has to be moved to
+ # the left side of the string. This should be done in
+ # a way which works even when surrounding text is not
+ # supported. We can do it by forwarding as many
+ # arrow-left events to the application as the
+ # committed string has characters. Because it might
+ # have been control-arrow-left, we need to clear the
+ # CONTROL_MASK:
for c in commit_string:
- self.forward_key_event(key.val, key.code, key.state)
+ self.forward_key_event(
+ key.val, key.code,
+ key.state & ~IBus.ModifierType.CONTROL_MASK)
# Forward the key event which triggered the commit here
# and return True instead of trying to pass that key event
# to the application by returning False. Doing it by
Repository : http://git.fedorahosted.org/git/?p=ibus-typing-booster.git
On branch : master
>---------------------------------------------------------------
commit e7c0aed01e92fc219ddea0314e1348f85dfb499b
Author: Mike FABIAN <mfabian(a)redhat.com>
Date: Tue Dec 15 18:24:51 2015 +0100
Use Msymbols instead of just characters when transliterating and storing the typed input
Resolves: rhbz#772665 - [RFE] Need support for AltGr mappings
See: https://bugzilla.redhat.com/show_bug.cgi?id=772665
Resolves: rhbz#1051405 - inscript2 layouts are not supported in ibus-typing-booster
See: https://bugzilla.redhat.com/show_bug.cgi?id=1051405
>---------------------------------------------------------------
ibus-typing-booster/engine/hunspell_table.py | 62 +++++++++++++------------
1 files changed, 32 insertions(+), 30 deletions(-)
diff --git a/ibus-typing-booster/engine/hunspell_table.py b/ibus-typing-booster/engine/hunspell_table.py
index 5f3b66a..169e37b 100644
--- a/ibus-typing-booster/engine/hunspell_table.py
+++ b/ibus-typing-booster/engine/hunspell_table.py
@@ -946,15 +946,13 @@ class tabengine (IBus.Engine):
self._editor.insert_string_at_cursor(list(token))
self._update_ui()
return True
- if (key.val >= 32
- and (not (key.state & IBus.ModifierType.CONTROL_MASK))):
- typed_character = IBus.keyval_to_unicode(key.val)
+ if key.val >= 32 and not key.control:
# If the first character typed is a character which is
# very unlikely to be part of a word
# (e.g. punctuation, a symbol, ..), we might want to
# avoid completion and commit something immediately:
- if (typed_character
- and unicodedata.category(typed_character)
+ if (len(key.msymbol) == 1
+ and unicodedata.category(key.msymbol)
in itb_util.categories_to_trigger_immediate_commit):
if not self._editor.trans_m17n_mode:
# Do not just pass the character through,
@@ -963,7 +961,7 @@ class tabengine (IBus.Engine):
# between the ���.��� and the previous word and this is
# done in commit_string().
self.commit_string(
- typed_character, input_phrase = typed_character)
+ key.msymbol, input_phrase = key.msymbol)
return True
# If transliteration is used, we may need to
# handle a punctuation or symbol character. For
@@ -972,11 +970,11 @@ class tabengine (IBus.Engine):
# therefore we cannot just pass it through. Just
# add it to the input so far and see what comes
# next:
- self._editor.insert_string_at_cursor(list(typed_character))
+ self._editor.insert_string_at_cursor([key.msymbol])
self._update_ui()
return True
if (self._use_digits_as_select_keys
- and typed_character
+ and key.msymbol
in ('1', '2', '3', '4', '5', '6', '7', '8', '9')):
# If digits are used as keys to select candidates
# it is not possibly to type them while the pre��dit
@@ -995,7 +993,7 @@ class tabengine (IBus.Engine):
# want ���3��� to be converted to ���������. So we try
# to transliterate and commit the result:
transliterated_digit = self._editor.trans.transliterate(
- list(typed_character))
+ [key.msymbol])
self.commit_string(
transliterated_digit, input_phrase=transliterated_digit)
return True
@@ -1033,8 +1031,7 @@ class tabengine (IBus.Engine):
self._update_ui ()
return res
- if (key.val == IBus.KEY_BackSpace
- and key.state & IBus.ModifierType.CONTROL_MASK):
+ if key.val == IBus.KEY_BackSpace and key.control:
if self._editor.is_empty():
return False
self._editor.remove_string_before_cursor()
@@ -1048,8 +1045,7 @@ class tabengine (IBus.Engine):
self._update_ui()
return True
- if (key.val == IBus.KEY_Delete
- and key.state & IBus.ModifierType.CONTROL_MASK):
+ if key.val == IBus.KEY_Delete and key.control:
if self._editor.is_empty():
return False
self._editor.remove_string_after_cursor()
@@ -1063,8 +1059,16 @@ class tabengine (IBus.Engine):
self._update_ui()
return True
- # Commit or remove a candidate:
- if self._editor.get_candidates():
+ # Select a candidate to commit or remove:
+ if self._editor.get_candidates() and not key.mod1 and not key.mod5:
+ # key.mod1 (= Alt) and key.mod5 (= AltGr) should not be set
+ # here because:
+ #
+ # - in case of the digits these are used for input, not to select
+ # (e.g. mr-inscript2 transliterates AltGr-4 to ���������)
+ #
+ # - in case of the F1-F9 keys I want to reserve the Alt and AltGr
+ # modifiers for possible future extensions.
index = -1
if self._use_digits_as_select_keys:
if key.val >= IBus.KEY_1 and key.val <= IBus.KEY_9:
@@ -1074,7 +1078,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):
+ if key.control:
# Remove the candidate from the user database
res = self._editor.remove_candidate_from_user_database(
index)
@@ -1125,7 +1129,7 @@ class tabengine (IBus.Engine):
if (key.val in (IBus.KEY_Right, IBus.KEY_KP_Right)
and (self._editor._typed_string_cursor
< len(self._editor._typed_string))):
- if key.state & IBus.ModifierType.CONTROL_MASK:
+ if key.control:
# Move cursor to the end of the typed string
self._editor._typed_string_cursor = len(
self._editor._typed_string)
@@ -1135,7 +1139,7 @@ class tabengine (IBus.Engine):
return True
if (key.val in (IBus.KEY_Left, IBus.KEY_KP_Left)
and self._editor._typed_string_cursor > 0):
- if key.state & IBus.ModifierType.CONTROL_MASK:
+ if key.control:
# Move cursor to the beginning of the typed string
self._editor._typed_string_cursor = 0
else:
@@ -1190,19 +1194,18 @@ class tabengine (IBus.Engine):
self.forward_key_event(key.val, key.code, key.state)
return True
- if IBus.keyval_to_unicode(key.val):
+ if key.unicode:
if self._editor.is_empty():
# first key typed, we will try to complete something now
# get the context if possible
self.get_context()
- typed_character = IBus.keyval_to_unicode(key.val)
- self._editor.insert_string_at_cursor(list(typed_character))
- if (typed_character
- and unicodedata.category(typed_character)
+ self._editor.insert_string_at_cursor([key.msymbol])
+ if (len(key.msymbol) == 1
+ and unicodedata.category(key.msymbol)
in itb_util.categories_to_trigger_immediate_commit):
input_phrase = self._editor.get_transliterated_string()
if (input_phrase
- and input_phrase[-1] == typed_character
+ and input_phrase[-1] == key.msymbol
and not self._editor.trans_m17n_mode):
self.commit_string(
input_phrase + u' ', input_phrase = input_phrase)
@@ -1211,12 +1214,11 @@ class tabengine (IBus.Engine):
# 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���.
+ # The unicode character for this key is apparently the empty
+ # string. 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):
Repository : http://git.fedorahosted.org/git/?p=ibus-typing-booster.git
On branch : master
>---------------------------------------------------------------
commit a2f95b5e55ad1e4c060af9e2e3e25999a86e1bbe
Author: Mike FABIAN <mfabian(a)redhat.com>
Date: Tue Dec 15 16:32:40 2015 +0100
Add an is_ascii() utility function
>---------------------------------------------------------------
ibus-typing-booster/engine/itb_util.py | 29 ++++++++++++++++++++++++++++-
1 files changed, 28 insertions(+), 1 deletions(-)
diff --git a/ibus-typing-booster/engine/itb_util.py b/ibus-typing-booster/engine/itb_util.py
index b901db1..9cbc76b 100755
--- a/ibus-typing-booster/engine/itb_util.py
+++ b/ibus-typing-booster/engine/itb_util.py
@@ -3,7 +3,7 @@
#
# ibus-typing-booster - The Tables engine for IBus
#
-# Copyright (c) 2013 Mike FABIAN <mfabian(a)redhat.com>
+# Copyright (c) 2013-2015 Mike FABIAN <mfabian(a)redhat.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -65,3 +65,30 @@ def tokenize(text):
tokens.append(strip_token(s))
return tokens
+def is_ascii(text):
+ '''Checks whether all characters in text are ASCII characters
+
+ Returns ���True��� if the text is all ASCII, ���False��� if not.
+
+ :param text: The text to check
+ :type text: string
+ :rtype: bool
+
+ Examples:
+
+ >>> is_ascii('Abc')
+ True
+
+ >>> is_ascii('Na��ve')
+ False
+ '''
+ try:
+ text.encode('ascii')
+ except UnicodeEncodeError:
+ return False
+ else:
+ return True
+
+if __name__ == "__main__":
+ import doctest
+ doctest.testmod()