Discussion:
[dev] [st] How to make it distinguish Control-p from Control-P?
Daniel Vartanov
2018-05-16 14:49:37 UTC
Permalink
Currently st does not tell ^p from ^P (any letter goes here, "P" is
here only as an example).
Is there way to make Contol-sequences case sensitive?

Just in case it is relevant, I need it to set certain hot keys in tmux.

Thanks,
Daniel
Martin Tournoij
2018-05-16 15:20:58 UTC
Permalink
Post by Daniel Vartanov
Currently st does not tell ^p from ^P (any letter goes here, "P" is
here only as an example).
Is there way to make Contol-sequences case sensitive?
That's not really how terminals work. Terminals are text driven and
communication happens by sending ASCII codes.

^P is 0x10 in ASCII. There is no code for ^p (lower-case). More advanced
sequences (like arrow keys, Home, F keys, etc.) are done by sending the
escape key (0x1b) followed by several more characters.

I don't think there is any terminal emulator that allows separating ^P
from ^p?
harry666t
2018-05-17 18:06:31 UTC
Permalink
The terminal is still the lowest common denominator in user
interfaces. Which is Good, because while it restrains you from doing a
few useful things, it also stops everyone else from doing some
extremely harmful things. Sadly that also means there's little
incentive for fixing the awful stuff (like the escape code madness),
if from the end user's POV there are no new features.

So I'll bring up a thread from 2011, just for reference...
https://lists.suckless.org/dev/1105/8083.html
I would be interested in an "alternative timeline" terminal emulator &
protocol, which ticks all of these check boxes:
- unicode is not an afterthought
- line oriented I/O (shell / "conversation" mode) is as easy and
stupid to do as it is with this timeline's tech
- character cell oriented UI with raw keyboard input is a matter of
flicking one switch
- fully serializable protocol, so we can use it over serial / SSH / etc
- writing both a "server" (terminal emulator) and "client" (app)
component from scratch in plain old C should be a "programming 102"
exercise, like writing a simple HTTP server / client

I'm sure this exists in some alternate universe. I'm sure the effort
for creating this from scratch based on the above requirements would
be infinitely lower than building a device for actual cross-universe
travel.

Just dumping this here to tease our hacker minds.
<3,K.
Roberto E. Vargas Caballero
2018-05-17 19:28:41 UTC
Permalink
I am sorry, but st hasn't super powers, and it cannot do impossible things.
Control mask the upper bits of the key (key & 0x1F) while shift clears the
6th bit, so ctrl+shift+p = (p & ~0x20) & 0x1f. As you can see, it is
impossible to differentiate between ^p and ^P.

Regards,

Loading...