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

Aleksey Tsalolikhin <[email protected]>
Newsgroups gmane.comp.gnu.screen.user
Message-ID <CA+jMWoeWHF73yCv0LUL2aLME8gQ=v4CqRVtOdmgaV740n31TEQ@mail.gmail.com>
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 <luteijn-qWit8jRvyhVmR6Xm/[email protected]> 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
> screen-users-mXXj517/[email protected]
> https://lists.gnu.org/mailman/listinfo/screen-users
>
>


-- 
Need CFEngine training?  Email training-c/GIo7RCy9aNyQASi3ws4laTQe2KTcn/@public.gmane.org

_______________________________________________
screen-users mailing list
screen-users-mXXj517/[email protected]
https://lists.gnu.org/mailman/listinfo/screen-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.