-
-
Notifications
You must be signed in to change notification settings - Fork 76
Input escape sequences: Allow to parameterize the modifier #5046
Description
Is there an existing request for this?
- I have searched the existing issues
Is your feature request related to a problem?
Global mc.lib and the user's ini file allows to define the escape sequences for keys with modifiers, e.g.
[terminal:foo]
up=\\e[A
shift-up=\\e[1;2A
alt-up=\\e[1;3A
alt-shift-up=\\e[1;4A
ctrl-up=\\e[1;5A
ctrl-shift-up=\\e[1;6A
ctrl-alt-up=\\e[1;7A
ctrl-alt-shift-up=\\e[1;8A
and repeat for every key.
xterm and most other modern terminals follow a certain pattern (as shown above) if at least one modifier is pressed, encoding the modifiers consistently in a single digit (although the modifier-less version doesn't fit in this pattern).
Let's introduce some magic syntax that unrolls all these 7 modifier combos, something like
[terminal:foo]
up=\\e[A
any-up=\\e[1;#A
My work-in-progress branch https://github.com/egmontkob/mc/tree/4632-shifted-function-keys already does this at the built-in tables.
For the config file we don't want to break them in the future, so we have to carefully choose the syntax, it'll stay with us. Does the any- prefix look good? What should be the placeholder? # seems fine, it is the number sign, and so far none of such escape sequences I've encountered contain a literal #. But could be _, %d, (n) etc. And whatever it is, ideally we should support \-escaping to preserve it literally.
Describe the solution you'd like
.
Describe alternatives you've considered
No response
Additional context
No response