Skip to content

Commit

Permalink
Add 'G-_' to 'G- ' as exceptions which must not trigger commits but i…
Browse files Browse the repository at this point in the history
…nsert into the preedit

Resolves: #243
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2002199

The German neo2 layout uses ISO_Level3_Shift+v (= CapsLock+w on a QWERTY layout)
to type an underscore '_'. That means when an underscore is typed using
that layout, key.msymbol is 'G-_'. This triggered a commit instead of inserting
the '_' into the preedit which made it impossible to add a '_' to the preedit
to trigger the emoji mode.

This commit fixes this problem by making another exception for 'G-_'.
  • Loading branch information
mike-fabian committed Sep 13, 2021
1 parent 60c300c commit 0da5d09
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions engine/hunspell_table.py
Expand Up @@ -5720,7 +5720,7 @@ def _process_key_event(self, key: itb_util.KeyEvent) -> bool:
return True

# These keys may trigger a commit:
if (key.msymbol not in ('G- ',)
if (key.msymbol not in ('G- ', 'G-_')
and (key.val in self._commit_trigger_keys
or (len(key.msymbol) == 1
and (key.control
Expand Down Expand Up @@ -5760,7 +5760,10 @@ def _process_key_event(self, key: itb_util.KeyEvent) -> bool:
#
# 'G- ' (AltGr-Space) is prevented from triggering
# a commit here, because it is used to enter spaces
# into the preëdit, if possible.
# into the preëdit, if possible. Same for 'G-_',
# it is prevented from triggering a commit because
# it is used to enter underscores into the preedit
# for emoji lookup.
#
# If key.msymbol is a single character and Control,
# Alt, Super, Hyper, or Meta is pressed, commit the
Expand Down Expand Up @@ -6038,7 +6041,7 @@ def _process_key_event(self, key: itb_util.KeyEvent) -> bool:
self._current_case_mode = 'upper'
if self._input_hints & itb_util.InputHints.LOWERCASE:
self._current_case_mode = 'lower'
if (key.msymbol in ('G- ',)
if (key.msymbol in ('G- ', 'G-_')
and not self._has_transliteration([key.msymbol])):
insert_msymbol = ' '
else:
Expand Down

0 comments on commit 0da5d09

Please sign in to comment.