From e9cdc9393544651c7124856c394f064b760e2409 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 30 Mar 2021 13:59:51 -0400 Subject: [PATCH] import ibus-typing-booster-2.1.0-5.el8 --- ...kSpace-from-reopening-a-preedit-when.patch | 50 +++++++++++++++++ SOURCES/gating.patch | 54 +++++++++++++++++++ SPECS/ibus-typing-booster.spec | 49 ++++++++++++++++- 3 files changed, 151 insertions(+), 2 deletions(-) create mode 100644 SOURCES/Prevent-also-BackSpace-from-reopening-a-preedit-when.patch create mode 100644 SOURCES/gating.patch diff --git a/SOURCES/Prevent-also-BackSpace-from-reopening-a-preedit-when.patch b/SOURCES/Prevent-also-BackSpace-from-reopening-a-preedit-when.patch new file mode 100644 index 0000000..f05fddc --- /dev/null +++ b/SOURCES/Prevent-also-BackSpace-from-reopening-a-preedit-when.patch @@ -0,0 +1,50 @@ +From 956b0cf51f7d3803bb605695c4ccc6fea77524a8 Mon Sep 17 00:00:00 2001 +From: Mike FABIAN +Date: Thu, 27 Feb 2020 15:50:37 +0100 +Subject: [PATCH] =?UTF-8?q?Prevent=20also=20BackSpace=20from=20reopening?= + =?UTF-8?q?=20a=20preedit=20when=20the=20option=20=E2=80=9CArrow=20keys=20?= + =?UTF-8?q?can=20reopen=20a=20preedit=E2=80=9D=20is=20off?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Reopening the preedit is so terribly buggy, especially under Gnome Wayland +but also in many other applications. + +Often surrounding text is reported as supported by the application but +ibus-typing-booster then gets completely wrong results when querying +the surrounding text. Without properly working surrounding text, +reopening a preedit cannot work correctly either. + +Until now this option switched reopening the preedit on and off only for the arrow keys. +So even when this was switched off for the arrow keys, it was still causing problems +when using backspace in case of broken support for surrounding text. + +Now reopening preedits is disabled completely when this option is off, which is +better in most cases as surrounding text is so terribly broken. + +One can still turn it on, it might be helpful in some cases where +surrounding text works reasonably well (e.g. in gedit when using Xorg +and not Wayland). But in most cases it is unfortunately better to +switch this off. +--- + engine/hunspell_table.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/engine/hunspell_table.py b/engine/hunspell_table.py +index 9214254..e3b61cf 100644 +--- a/engine/hunspell_table.py ++++ b/engine/hunspell_table.py +@@ -2396,7 +2396,8 @@ class TypingBoosterEngine(IBus.Engine): + return self._return_false(key.val, key.code, key.state) + if (not self._arrow_keys_reopen_preedit + and key.val in (IBus.KEY_Left, IBus.KEY_KP_Left, +- IBus.KEY_Right, IBus.KEY_KP_Right)): ++ IBus.KEY_Right, IBus.KEY_KP_Right, ++ IBus.KEY_BackSpace)): + # using arrows key to reopen the preëdit is disabled + return self._return_false(key.val, key.code, key.state) + if (key.shift +-- +2.29.2 + diff --git a/SOURCES/gating.patch b/SOURCES/gating.patch new file mode 100644 index 0000000..abcb069 --- /dev/null +++ b/SOURCES/gating.patch @@ -0,0 +1,54 @@ +diff -ru ibus-typing-booster-2.1.0.orig/tests/run_tests.in ibus-typing-booster-2.1.0/tests/run_tests.in +--- ibus-typing-booster-2.1.0.orig/tests/run_tests.in 2018-06-05 11:32:44.000000000 +0200 ++++ ibus-typing-booster-2.1.0/tests/run_tests.in 2020-06-09 17:52:21.789989905 +0200 +@@ -21,6 +21,21 @@ + import sys + import unittest + ++# pip3 install tap.py --user ++IMPORT_TAP_SUCCESSFUL = False ++try: ++ from tap import TAPTestRunner ++ IMPORT_TAP_SUCCESSFUL = True ++except (ImportError,): ++ pass ++ ++if 'IBUS_TYPING_BOOSTER_LOCATION' in os.environ: ++ location_path = os.environ['IBUS_TYPING_BOOSTER_LOCATION'] ++ if location_path != None and location_path != '': ++ engine_path = os.path.join(location_path, 'engine') ++ sys.path.append(engine_path) ++sys.path.append('/usr/share/ibus-typing-booster/engine') ++ + from gi import require_version + require_version('IBus', '1.0') + from gi.repository import IBus +@@ -182,10 +197,25 @@ + sys.modules["gi.repository.IBus"].PropList = MockPropList + + # -- Load and run our unit tests --------------------------------------------- +-os.environ['IBUS_TYPING_BOOSTER_DEBUG_LEVEL'] = '255' ++pattern = 'test*.py' ++start_dir = os.path.dirname(__file__) ++if len(sys.argv) > 1: ++ pattern = sys.argv[-1] ++ dir = os.path.dirname(pattern) ++ pattern = os.path.basename(pattern) ++ if dir != '.': ++ start_dir = os.path.join(start_dir, dir) + loader = unittest.TestLoader() +-suite = loader.discover(".") +-runner = unittest.TextTestRunner(stream = sys.stderr, verbosity = 255) ++suite = loader.discover(start_dir=start_dir, pattern=pattern) ++ ++if IMPORT_TAP_SUCCESSFUL: ++ runner = TAPTestRunner(stream=sys.stderr, verbosity=255) ++ runner.set_outdir('.') ++ runner.set_format('Hi: {method_name} - {short_description}') ++ runner.set_combined(True) ++else: ++ runner = unittest.TextTestRunner(stream=sys.stderr, verbosity=255) ++ + result = runner.run(suite) + + if result.failures or result.errors: diff --git a/SPECS/ibus-typing-booster.spec b/SPECS/ibus-typing-booster.spec index 297b826..6bce647 100644 --- a/SPECS/ibus-typing-booster.spec +++ b/SPECS/ibus-typing-booster.spec @@ -1,11 +1,13 @@ Name: ibus-typing-booster Version: 2.1.0 -Release: 3%{?dist} +Release: 5%{?dist} Summary: A completion input method License: GPLv3+ Group: System Environment/Libraries URL: https://mike-fabian.github.io/ibus-typing-booster/ Source0: https://github.com/mike-fabian/ibus-typing-booster/releases/download/%{version}/ibus-typing-booster-%{version}.tar.gz +Patch0: gating.patch +Patch1: Prevent-also-BackSpace-from-reopening-a-preedit-when.patch Requires: ibus >= 1.5.3 Requires: m17n-lib Requires: python(abi) >= 3.3 @@ -39,6 +41,9 @@ BuildRequires: m17n-lib BuildRequires: m17n-db-extras BuildRequires: python3-enchant BuildRequires: libappstream-glib +BuildRequires: desktop-file-utils +BuildRequires: python3-gobject +BuildRequires: python3-gobject-base BuildRequires: hunspell-cs BuildRequires: hunspell-de BuildRequires: hunspell-en @@ -47,12 +52,24 @@ BuildRequires: hunspell-fr BuildRequires: hunspell-it BuildRequires: hunspell-ko BuildRequires: glib2 +BuildRequires: gtk3 +BuildRequires: dconf +BuildRequires: dbus-x11 +BuildRequires: ibus BuildArch: noarch %description Ibus-typing-booster is a context sensitive completion input method to speedup typing. +%package tests +Summary: Tests for the %{name} package +Requires: %{name} = %{version}-%{release} + +%description tests +The %{name}-tests package contains tests that can be used to verify +the functionality of the installed %{name} package. + %package -n emoji-picker Summary: An emoji selection tool Requires: ibus-typing-booster = %{version}-%{release} @@ -63,7 +80,8 @@ Unicode symbols. %prep %setup -q - +%patch0 -p1 -b .gating +%patch1 -p1 -b .backspace %build export PYTHON=%{__python3} @@ -91,6 +109,18 @@ make install DESTDIR=${RPM_BUILD_ROOT} NO_INDEX=true INSTALL="install -p" pkg gzip -n --force --best $RPM_BUILD_ROOT/%{_datadir}/%{name}/data/annotationsDerived/*.xml %endif +mkdir -p $RPM_BUILD_ROOT/%{_libexecdir}/installed-tests/%{name} +mkdir -p $RPM_BUILD_ROOT/%{_datadir}/installed-tests/%{name} +make -C tests run_tests +cp tests/run_tests $RPM_BUILD_ROOT/%{_libexecdir}/installed-tests/%{name} +cp tests/test_itb.py $RPM_BUILD_ROOT/%{_libexecdir}/installed-tests/%{name} +cat < $RPM_BUILD_ROOT/%{_datadir}/installed-tests/%{name}/test_itb.test +[Test] +Type=session +Exec=/usr/libexec/installed-tests/ibus-typing-booster/run_tests test_itb.py +Output=TAP +EOF + %find_lang %{name} %check @@ -157,12 +187,27 @@ make check || cat ./tests/test-suite.log %{_datadir}/applications/ibus-setup-typing-booster.desktop %{_datadir}/glib-2.0/schemas/org.freedesktop.ibus.engine.typing-booster.gschema.xml +%files tests +%dir %{_libexecdir}/installed-tests +%{_libexecdir}/installed-tests/%{name} +%dir %{_datadir}/installed-tests +%{_datadir}/installed-tests/%{name} + %files -n emoji-picker %{_bindir}/emoji-picker %{_datadir}/applications/emoji-picker.desktop %changelog +* Thu Feb 04 2021 Mike FABIAN - 2.1.0-5 +- Prevent also BackSpace from reopening a preedit when the + option “Arrow keys can reopen a preedit” is off +- Resolves: rhbz#1925030 + +* Tue Jun 09 2020 Mike FABIAN - 2.1.0-4 +- Add gating tests +- Resolves: rhbz#1682164 + * Tue Oct 09 2018 Mike FABIAN - 2.1.0-3 - Make “make check“ test cases work again when building the rpm (To avoid that rpmdiff in the errata tool reports a problem)