diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2024-09-04 18:56:09 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2024-09-09 18:22:21 +0200 |
commit | 0e6e0590272c8ba2303af3682d29209f439177d9 (patch) | |
tree | 62fd2b4e02043e10cb52b7bcc581283e0fb2a5df /src/parser.h | |
parent | 893a0a6ad85411a57c1225af03260b34561377c7 (diff) | |
download | sciteco-0e6e0590272c8ba2303af3682d29209f439177d9.tar.gz |
Gtk: ignore the keyboard layout whereever possible (refs #5)
* Eg. when typing with a Russian layout, CTRL+I will always insert ^I.
* Works with all of the start-state command Ex, Fx, ^x commands and
string building constructs.
This is exactly where process_edit_cmd_cb() case folds case-insensitive
characters.
The corresponding state therefore sets an is_case_insensitive flag now.
* Does not yet work with anything embedded into Q-Register specifications.
This could only be realized with a new state callback (is_case_insensitive()?)
that chains to the Q-Register and string building states recursively.
* Also it doesn't work with Ё on my Russian phonetic layout,
probably because the ANSI caret on that same key is considered dead
and not returned by gdk_keyval_to_unicode().
Perhaps we should directly wheck the keyval values?
* Whenever a non-ANSI key is pressed in an allowed state,
we try to check all other keyvals that could be produced by the same
hardware keycode, ie. we check all groups (keyboard layouts).
Diffstat (limited to 'src/parser.h')
-rw-r--r-- | src/parser.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/parser.h b/src/parser.h index ba6054f..09ec483 100644 --- a/src/parser.h +++ b/src/parser.h @@ -189,6 +189,15 @@ struct teco_state_t { */ bool is_start : 1; /** + * Whether this state accepts case insensitive characters, + * ie. is part of a command name, that can be case folded. + * This is also used to determine which state accepts only + * ANSI characters. + * @fixme But it should be callback to detect all + * string building constructs nested in Q-Reg specs. + */ + bool is_case_insensitive : 1; + /** * Function key macro mask. * This is not a bitmask since it is compared with values set * from TECO, so the bitorder needs to be defined. @@ -252,13 +261,14 @@ gboolean teco_state_caseinsensitive_process_edit_cmd(teco_machine_t *ctx, teco_m * @implements TECO_DEFINE_STATE * @ingroup states * - * Base class of states with case-insenstive input. + * Base class of states with case-insensitive input. * * This is meant for states accepting command characters * that can possibly be case-folded. */ #define TECO_DEFINE_STATE_CASEINSENSITIVE(NAME, ...) \ TECO_DEFINE_STATE(NAME, \ + .is_case_insensitive = TRUE, \ .process_edit_cmd_cb = teco_state_caseinsensitive_process_edit_cmd, \ ##__VA_ARGS__ \ ) |