help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: keybindings again...


From: Yuri Khan
Subject: Re: keybindings again...
Date: Fri, 30 Jun 2017 13:22:56 +0700

On Fri, Jun 30, 2017 at 12:10 PM, Jean-Christophe Helary
<jean.christophe.helary@gmail.com> wrote:

>> I'm trying to assign M-S-RET to org-insert-todo-heading because for some 
>> reason it is not assigned by default: every time I hit ESC S-RET I get ESC 
>> RET only.
>>
>> It's the limitation of the terminal.
>
> Do you mean that Shift is not recognized as a modified key by the terminal ?

A brief recap of terminal limitations, from a guy who has never used a
real hardware terminal.

The protocol by which a terminal passes keystrokes to an application
is that of an ASCII character stream, with only minor extensions
(these days it’s a UTF-8-encoded character stream). It predates the
notion of keyboard as an interactive input device.

In that protocol, there are 32 control characters with codes 0 through
31 (decimal). They are associated with Ctrl+@, Ctrl+A, …, Ctrl+Z,
Ctrl+[, Ctrl+\, Ctrl+], Ctrl+^ and Ctrl+_, and terminals pass these
character codes when these key combinations are pressed, with or
without Shift. Also, there is the control character 127, sometimes
written as Ctrl+?.

Additionally, the most frequent of these control characters have been
given single keys. These are RET = Ctrl+M, TAB = Ctrl+I, ESC = Ctrl+[,
sometimes BS = Ctrl+H, and sometimes DEL = Ctrl+?.

It follows that many terminals emit identical character codes for C-m,
C-M, RET and S-RET; C-i, C-I, TAB and S-TAB; C-[, C-{, ESC and S-ESC;
and C-?, DEL and S-DEL; the application running on the other side
cannot distinguish them.


GUI systems, on the other hand, were developed after keyboards had
been available for many years. Thus, most of they do allow
applications to distinguish any keys with any modifiers.

Some GUI terminal emulators have taken advantage of their GUI nature,
and started passing distinct escape sequences for some key
combinations. For example, Xterm emits ESC [ Z when I press Shift+Tab.

Some GUI terminal emulators also let the user customize which
character sequences they send on which keys.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]