screen-users
[Top][All Lists]
Advanced

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

Re: Why does "\024" mean `C-t'? (in bindkey example in man page)


From: Aleksey Tsalolikhin
Subject: Re: Why does "\024" mean `C-t'? (in bindkey example in man page)
Date: Sun, 14 Aug 2016 07:11:26 -0700

Lovely, thank you very much Axel and Pieter!

Why does pressing ctrl-1 make 1, and pressing ctrl-3 make ^[ ?  Pressing ctrl-8 makes nothing, like Pieter said (you can't shift 042 down by 64).

Axel's script was very helpful! I added display of the binary value which helped me to understand the relationship between character, lower-case version, and control-version:

    perl -E 'while (my $l=<>){ chomp($l); say join(" ", map { my $c=ord($_); sprintf("x%02X=o%03o=d%i", $c,$c,$c) } split(//,$l)) }'

So it seems like ^A is the "base" form, and upper-case and lower-case versions are modifications of that base.

  ^A
  b00000001 = x01 = o001 = d1 

  A
  b01000001 = x41 = o101 = d65 

  a
  b01100001 = x61 = o141 = d97 

It's funny, because I think of Control as being some extra that I add, but really it's the basic form.  Still trying to wrap my mind around that...  I read the first version of the standard (1963), which I found through https://en.wikipedia.org/wiki/ASCII#History but there is no mention there of using the alphabet to represent control characters.  I have to go off to work now but I plan to study subsequent versions of the standard to understand where that came in.

Thanks!!

Best,
Aleksey

On Sat, Aug 13, 2016 at 11:37 PM, Pieter Luteijn <address@hidden> wrote:
Hi,

In short, pressing ctrl+{other key} just sends a code that's 64 (dec) lower than then {other key} by itself. So ctrl-@ sends '0' (NUL), ctrl-C sends '3', ctrl-T '20'. To make it easy, no difference is made between upper/lowercase. Look at an ASCII table, as this method is/was meant to send codes from 0-31 (with 32 having its own key, spacebar), and you'll see why some non-letter {other keys} like '[' or ']' work, but others like e.g. '*' (usually) don't. 

Regards,
Pieter

Sent from a mobile, sorry for any typoes...

_______________________________________________
screen-users mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/screen-users




--
Need CFEngine training?  Email address@hidden

reply via email to

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