mike-fabian / ibus-typing-booster

ibus-typing-booster is a completion input method for faster typing
https://mike-fabian.github.io/ibus-typing-booster/
Other
232 stars 16 forks source link

Phrases inside parentheses are treated as a single word #223

Closed psads-git closed 3 years ago

psads-git commented 3 years ago

Hi, Mike,

When one writes a phrase inside parentheses, ibus-typing-booster treats the entire phrase as a single word and not as being several words.

Thanks!

mike-fabian commented 3 years ago

Example?

psads-git commented 3 years ago

Please, Mike, see the example of line 1 in the attached video:

https://user-images.githubusercontent.com/75945439/130294711-eed3f8f8-bdfe-4e8a-84c7-61df44269066.mp4

mike-fabian commented 3 years ago

This commit caused the behaviour reported here:

commit dfa8fa1f8137ae08ac107b183d0bd77fc6aeef0f Author: Mike FABIAN mfabian@redhat.com Date: Fri Aug 6 10:18:24 2021 +0200

Improve typing space or Tab when the cursor is not at the end of the preedit

Resolves: https://github.com/mike-fabian/ibus-typing-booster/issues/198
mike-fabian commented 3 years ago

The behaviour before this attempted fix wasn’t good either, when typing space while inside a preedit (when no candidate was selected!) committed and jumped to the end of the text.

I think the “best” behaviour is to commit and insert the space at the cursor position.

Trying to fix it that way ... ⏳

psads-git commented 3 years ago

Thanks, Mike!

mike-fabian commented 3 years ago

Here is a test build of 2.14.4:

https://copr.fedorainfracloud.org/coprs/mfabian/ibus-typing-booster/build/2532651/

I think this works better.

psads-git commented 3 years ago

It seems to be now working perfectly, Mike. Thanks for your permanent readiness to improve ibus-typing-booster and hence its users benefits!

mike-fabian commented 3 years ago

I released 2.14.4 now:

https://github.com/mike-fabian/ibus-typing-booster/releases/tag/2.14.4

it includes several other small fixes.

mike-fabian commented 3 years ago

It seems to be now working perfectly, Mike. Thanks for your permanent readiness to improve ibus-typing-booster and hence its users benefits!

Thank you very much for testing so carefully, your reports are really useful because they say exactly what the problem is.

psads-git commented 3 years ago

A problem may be still remaining, Mike! When one writes

(word

all preedit suggestions begin with (. It is not clear whether ibus-typing-booster searches the database with

(word

or with

word.

psads-git commented 3 years ago

I am now certain that ibus-typing-booster searches the database with the word without parenthesis. Therefore, there is no issue.

mike-fabian commented 3 years ago

I am now certain that ibus-typing-booster searches the database with the word without parenthesis. Therefore, there is no issue.

Yes, it searches only for word.

https://github.com/mike-fabian/ibus-typing-booster/blob/main/engine/hunspell_table.py#L944

contains:

def _update_candidates(self) -> None:
        '''Update the list of candidates and fill the lookup table with the
        candidates

Which strips special characters from words:

               stripped_transliterated_string = (
                    itb_util.lstrip_token(self._transliterated_strings[ime]))

before doing the lookup:

                  candidates = self.database.select_words(
                            stripped_transliterated_string,
                            p_phrase=self._p_phrase,
                            pp_phrase=self._pp_phrase)

https://github.com/mike-fabian/ibus-typing-booster/blob/main/engine/itb_util.py#L130

contains the list of Unicode categories which are stripped:

CATEGORIES_TO_STRIP_FROM_TOKENS = (
    'Po', 'Pi', 'Pf', 'Ps', 'Pe', 'Pc', 'Pd'
)

( U+0028 LEFT PARENTHESIS has the Unicode category “Ps (Punctuation, Open)”

psads-git commented 3 years ago

Thanks, Mike!