Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

The following statement is not true. The previous statement is true.


devel / comp.lang.c++ / Parsing multi-byte keystrokes

SubjectAuthor
* Parsing multi-byte keystrokesR.Wieser
+* Re: Parsing multi-byte keystrokesAlf P. Steinbach
|+- Re: Parsing multi-byte keystrokesR.Wieser
|`* Re: Parsing multi-byte keystrokesKeith Thompson
| +* Re: Parsing multi-byte keystrokesPavel
| |`- Re: Parsing multi-byte keystrokesKeith Thompson
| `- Re: Parsing multi-byte keystrokesR.Wieser
+* Re: Parsing multi-byte keystrokesPavel
|+* Re: Parsing multi-byte keystrokesBen Bacarisse
||`* Re: Parsing multi-byte keystrokesR.Wieser
|| +- Re: Parsing multi-byte keystrokesChristian Gollwitzer
|| `* Re: Parsing multi-byte keystrokesBen Bacarisse
||  `* Re: Parsing multi-byte keystrokesR.Wieser
||   `* Re: Parsing multi-byte keystrokesChristian Gollwitzer
||    `* Re: Parsing multi-byte keystrokesR.Wieser
||     +- Re: Parsing multi-byte keystrokesKeith Thompson
||     `* Re: Parsing multi-byte keystrokesChristian Gollwitzer
||      `- Re: Parsing multi-byte keystrokesKeith Thompson
|`* Re: Parsing multi-byte keystrokesR.Wieser
| +* Re: Parsing multi-byte keystrokesKeith Thompson
| |`* Re: Parsing multi-byte keystrokesR.Wieser
| | +* Re: Parsing multi-byte keystrokesMuttley
| | |`- Re: Parsing multi-byte keystrokesR.Wieser
| | `* Re: Parsing multi-byte keystrokesKeith Thompson
| |  `* Re: Parsing multi-byte keystrokesR.Wieser
| |   +- Re: Parsing multi-byte keystrokesKeith Thompson
| |   `* Re: Parsing multi-byte keystrokesScott Lurndal
| |    `- Re: Parsing multi-byte keystrokesR.Wieser
| +* Re: Parsing multi-byte keystrokesScott Lurndal
| |+- Re: Parsing multi-byte keystrokesR.Wieser
| |`- Re: Parsing multi-byte keystrokesKeith Thompson
| +* Re: Parsing multi-byte keystrokesred floyd
| |`* Re: Parsing multi-byte keystrokesKenny McCormack
| | `* Re: Parsing multi-byte keystrokesScott Lurndal
| |  `* Re: Parsing multi-byte keystrokesR.Wieser
| |   `* Re: Parsing multi-byte keystrokesKenny McCormack
| |    `* Re: Parsing multi-byte keystrokesR.Wieser
| |     +* Re: Parsing multi-byte keystrokesBen Bacarisse
| |     |`* Re: Parsing multi-byte keystrokesR.Wieser
| |     | +* Re: Parsing multi-byte keystrokesScott Lurndal
| |     | |`- Re: Parsing multi-byte keystrokesR.Wieser
| |     | +* Re: Parsing multi-byte keystrokesPaavo Helde
| |     | |`- Re: Parsing multi-byte keystrokesR.Wieser
| |     | +- Re: Parsing multi-byte keystrokesBen Bacarisse
| |     | +* Re: Parsing multi-byte keystrokesKeith Thompson
| |     | |`* Re: Parsing multi-byte keystrokesR.Wieser
| |     | | `* Re: Parsing multi-byte keystrokesKeith Thompson
| |     | |  `* Re: Parsing multi-byte keystrokesR.Wieser
| |     | |   +* Re: Parsing multi-byte keystrokesChristian Gollwitzer
| |     | |   |`- Re: Parsing multi-byte keystrokesR.Wieser
| |     | |   +* Re: Parsing multi-byte keystrokesKeith Thompson
| |     | |   |`* Re: Parsing multi-byte keystrokesR.Wieser
| |     | |   | +- Re: Parsing multi-byte keystrokesScott Lurndal
| |     | |   | `- Re: Parsing multi-byte keystrokesJames Kuyper
| |     | |   `* Re: Parsing multi-byte keystrokesMuttley
| |     | |    `* Re: Parsing multi-byte keystrokesR.Wieser
| |     | |     +- Re: Parsing multi-byte keystrokesKenny McCormack
| |     | |     +* Re: Parsing multi-byte keystrokesJames Kuyper
| |     | |     |`* Re: Parsing multi-byte keystrokesScott Lurndal
| |     | |     | `* Re: Parsing multi-byte keystrokesJames Kuyper
| |     | |     |  `* Re: Parsing multi-byte keystrokesKalevi Kolttonen
| |     | |     |   +* Re: Parsing multi-byte keystrokesKeith Thompson
| |     | |     |   |`* Re: Parsing multi-byte keystrokesKalevi Kolttonen
| |     | |     |   | `- Re: Parsing multi-byte keystrokesScott Lurndal
| |     | |     |   `- Re: Parsing multi-byte keystrokesScott Lurndal
| |     | |     `* Re: Parsing multi-byte keystrokesMuttley
| |     | |      +* Re: Parsing multi-byte keystrokesDavid Brown
| |     | |      |+* Re: Parsing multi-byte keystrokesKalevi Kolttonen
| |     | |      ||+* Re: Parsing multi-byte keystrokesKenny McCormack
| |     | |      |||`- Re: Parsing multi-byte keystrokesKalevi Kolttonen
| |     | |      ||`* Re: Parsing multi-byte keystrokesDavid Brown
| |     | |      || +- Re: Parsing multi-byte keystrokesScott Lurndal
| |     | |      || +* Re: Parsing multi-byte keystrokesChris M. Thomasson
| |     | |      || |`- Re: Parsing multi-byte keystrokesScott Lurndal
| |     | |      || `- Re: Parsing multi-byte keystrokesKalevi Kolttonen
| |     | |      |`- Re: Parsing multi-byte keystrokesMuttley
| |     | |      `* Re: Parsing multi-byte keystrokesred floyd
| |     | |       +- Cars (Was: Parsing what is Linux?)Kenny McCormack
| |     | |       `* Re: Parsing multi-byte keystrokesMuttley
| |     | |        `* Cars (Was: Parsing multi-byte keystrokes)Kenny McCormack
| |     | |         `* Re: Cars (Was: Parsing multi-byte keystrokes)Muttley
| |     | |          `* Totally insane (Was: Cars (Was: Parsing multi-byte keystrokes))Kenny McCormack
| |     | |           `- Re: Totally insane (Was: Cars (Was: Parsing multi-byte keystrokes))Muttley
| |     | `* Re: Parsing multi-byte keystrokesJames Kuyper
| |     |  +- Re: Parsing multi-byte keystrokesKenny McCormack
| |     |  +* Re: Parsing multi-byte keystrokesR.Wieser
| |     |  |+* Re: Parsing multi-byte keystrokesJames Kuyper
| |     |  ||`* Re: Parsing multi-byte keystrokesR.Wieser
| |     |  || `* Re: Parsing multi-byte keystrokesJames Kuyper
| |     |  ||  `* Re: Parsing multi-byte keystrokesR.Wieser
| |     |  ||   `* Re: Parsing multi-byte keystrokesJames Kuyper
| |     |  ||    `* Re: Parsing multi-byte keystrokesR.Wieser
| |     |  ||     +- Re: Parsing multi-byte keystrokesScott Lurndal
| |     |  ||     `* Re: Parsing multi-byte keystrokesJames Kuyper
| |     |  ||      +* Re: Parsing multi-byte keystrokesRichard Harnden
| |     |  ||      |`- Re: Parsing multi-byte keystrokesKeith Thompson
| |     |  ||      +* Re: Parsing multi-byte keystrokesR.Wieser
| |     |  ||      |`- Re: Parsing multi-byte keystrokesJames Kuyper
| |     |  ||      `- Re: Parsing multi-byte keystrokesKeith Thompson
| |     |  |`* Re: Parsing multi-byte keystrokesDavid Brown
| |     |  | `* Re: Parsing multi-byte keystrokesR.Wieser
| |     |  `* Re: Parsing multi-byte keystrokesMalcolm McLean
| |     `* Re: Parsing multi-byte keystrokesAlf P. Steinbach
| `* Re: Parsing multi-byte keystrokesPavel
+* Re: Parsing multi-byte keystrokesScott Lurndal
`* Re: Parsing multi-byte keystrokeswij

Pages:123456
Re: Parsing multi-byte keystrokes

<u7bufa$ue5n$4@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=496&group=comp.lang.c%2B%2B#496

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: addr...@is.invalid (R.Wieser)
Newsgroups: comp.lang.c++
Subject: Re: Parsing multi-byte keystrokes
Date: Mon, 26 Jun 2023 13:56:43 +0200
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <u7bufa$ue5n$4@dont-email.me>
References: <u79ug0$i1ks$1@dont-email.me> <lZ3mM.83590$8uge.57668@fx14.iad> <87ilbb13tu.fsf@nosuchdomain.example.com> <u7bee2$sht9$5@dont-email.me> <u7bpe1$tnmt$1@dont-email.me>
Injection-Date: Mon, 26 Jun 2023 11:57:30 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="3e13d070687dc98f7060108e206c1d81";
logging-data="997559"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/uuVagn6oVpxV6F6BN0B61ooCA3eeSZsGfua1N/pQsYA=="
Cancel-Lock: sha1:1cAmGKbQkBjeldG/FcowpZgzU+4=
X-RFC2646: Format=Flowed; Response
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
 by: R.Wieser - Mon, 26 Jun 2023 11:56 UTC

Fred,

> Console for Linux is normally used for the console which uses a keyboard
> directly connected to the computer, e.g. with USB, or PS2.
>
> A terminal is more generic. E.g., originally terminals where connected
> with a serial line to a computer ad the terminal did the interpretation of
> the keyboard.

Yep, that is how I defined "console" and "terminal" myself too. The first
one part of the computer (in my case, all the ones behind the ALT F1...F6
keys), the second one remote to it (and talking to it using some kind of
serial connection).

But as you might have noticed, the definition does seem to differ between
the different people (noticed the same while searching the internet)

> Therefore, your request to detect pressing and releasing keys is not
> possible for generic terminal software.

I was already "afraid" of that, but it could not hurt to ask. Perhaps times
have changed and being able to capture a key release was added to (some
versions of) Linux.

Regards,
Rudy Wieser

Re: Parsing multi-byte keystrokes

<877crq4cbp.fsf@bsb.me.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=497&group=comp.lang.c%2B%2B#497

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c++
Subject: Re: Parsing multi-byte keystrokes
Date: Mon, 26 Jun 2023 13:50:34 +0100
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <877crq4cbp.fsf@bsb.me.uk>
References: <u79ug0$i1ks$1@dont-email.me> <Xm3mM.7635$3XE8.5950@fx42.iad>
<87edlz5cax.fsf@bsb.me.uk> <u7bee2$sht9$4@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="30bd7937b87860f973277a7390f3a6b0";
logging-data="1008910"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+A+woKACp6TIbXKJwpExd5E+TaHHUq/Cc="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:CcuoKuW5PL08uPp2RAALZ3S5mNk=
sha1:7WrmA9mBm2SkGCo8TO/bWz+/0is=
X-BSB-Auth: 1.c8717b2dab848f9bdbe3.20230626135034BST.877crq4cbp.fsf@bsb.me.uk
 by: Ben Bacarisse - Mon, 26 Jun 2023 12:50 UTC

"R.Wieser" <address@is.invalid> writes:

> Ben,
>
>> Essentially it "wraps" any interactive program with a
>> readline-driven editing, completion and history interface.
>
> Thats pretty-much the opposite of what I currently want/need.

Good to know. I suspected it was not the right thing but I had not read
every post carefully.

> I'm trying to write something thats interactive - For example, imagine a
> list of items you can move thru using the cursor keys and select pressing
> the spacebar.

There used to be libraries built on top of curses (and/or ncurses) that
provided higher-level user interaction widgets like this. I can't
remember if any caught on, but it might be worth looking before building
your own.

--
Ben.

Re: Parsing multi-byte keystrokes

<u7c3qt$v2jh$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=498&group=comp.lang.c%2B%2B#498

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: addr...@is.invalid (R.Wieser)
Newsgroups: comp.lang.c++
Subject: Re: Parsing multi-byte keystrokes
Date: Mon, 26 Jun 2023 15:03:26 +0200
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <u7c3qt$v2jh$1@dont-email.me>
References: <u79ug0$i1ks$1@dont-email.me> <Xm3mM.7635$3XE8.5950@fx42.iad><87edlz5cax.fsf@bsb.me.uk> <u7bee2$sht9$4@dont-email.me> <877crq4cbp.fsf@bsb.me.uk>
Injection-Date: Mon, 26 Jun 2023 13:29:01 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="3e13d070687dc98f7060108e206c1d81";
logging-data="1018481"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/9YKS9blO1cfdMF4ySrvZMYnfaTRiU1v+Tsqp+tT4hpw=="
Cancel-Lock: sha1:WtAet4XuPo9qe2Vyu8vxWHRjGEA=
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
X-Priority: 3
X-MSMail-Priority: Normal
 by: R.Wieser - Mon, 26 Jun 2023 13:03 UTC

Ben,

> There used to be libraries built on top of curses (and/or ncurses)
> that provided higher-level user interaction widgets like this.

I'm not looking for specifically the widgets (the example was just that,
something to be able to relate to), but for how to be able to do something
interactive with the keyboard. And for that I need to be able to extract
keystrokes from the input stream.

Regards,
Rudy Wieser

Re: Parsing multi-byte keystrokes

<KPgmM.111039$WpOe.22384@fx18.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=499&group=comp.lang.c%2B%2B#499

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!newsreader4.netcologne.de!news.netcologne.de!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx18.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Parsing multi-byte keystrokes
Newsgroups: comp.lang.c++
References: <u79ug0$i1ks$1@dont-email.me> <lZ3mM.83590$8uge.57668@fx14.iad> <87ilbb13tu.fsf@nosuchdomain.example.com>
Lines: 28
Message-ID: <KPgmM.111039$WpOe.22384@fx18.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Mon, 26 Jun 2023 13:58:02 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Mon, 26 Jun 2023 13:58:02 GMT
X-Received-Bytes: 1882
 by: Scott Lurndal - Mon, 26 Jun 2023 13:58 UTC

Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>scott@slp53.sl.home (Scott Lurndal) writes:
>> "R.Wieser" <address@is.invalid> writes:
>>>I've set the console input to raw so I can see keys coming in when they are
>>>pressed.
>>>
>>>For that I've been writing a big "switch ... case" to parse the multi-byte
>>>keystrokes into "records" that than can be easily worked with or discarded.
>>>
>>>As this parsing needs to be done by pretty-much every console-based program
>>>which wants to do any kind of interactive stuff I was wondering if this
>>>perhaps is already part of Linux ...
>>>
>>>If it is (and thats still a big "if"), where can I find it ?
>>
>> $ man console_ioctl
>
>I believe that only applies to the Linux system console (the text-only
>interface you typically get by typing Ctrl-Alt-N, where N is a small
>integer). I know the OP wrote "console", but I suspect they're looking
>for something that works on a terminal emulator.

I thought about that, but "console-based program" pretty much implied
no GUI.

With graphics, the toolkit (X11, GDK) provides interfaces to handle
and parse keystrokes.

Re: Parsing multi-byte keystrokes

<KRgmM.111040$WpOe.9616@fx18.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=500&group=comp.lang.c%2B%2B#500

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx18.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Parsing multi-byte keystrokes
Newsgroups: comp.lang.c++
References: <u79ug0$i1ks$1@dont-email.me> <lZ3mM.83590$8uge.57668@fx14.iad> <87ilbb13tu.fsf@nosuchdomain.example.com> <u7bee2$sht9$5@dont-email.me> <875y7a1v7t.fsf@nosuchdomain.example.com>
Lines: 28
Message-ID: <KRgmM.111040$WpOe.9616@fx18.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Mon, 26 Jun 2023 14:00:10 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Mon, 26 Jun 2023 14:00:10 GMT
X-Received-Bytes: 2050
 by: Scott Lurndal - Mon, 26 Jun 2023 14:00 UTC

Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>"R.Wieser" <address@is.invalid> writes:
>> Keith,
>>
>>> I know the OP wrote "console", but I suspect they're looking
>>> for something that works on a terminal emulator.
>>
>> Nope, not an emulator. As said, "bullseye lite" doesn't have a GUI.
>>
>> As for the difference between a "console" and a "terminal" ? I must say
>> that its not quite clear (read: confusing) to me , as it seems to be used
>> interchangably. If you have a good description about the differences
>> between a "console" and a "terminal" than I would like to hear about it.
>>
>> Simply said, to me a "console" is the text-based interface you get on a
>> 'puter thats executing the commands. A "terminal" is the program you use
>> to remotely(?) connect to such a console.
>
>The term "console", on Unix-like systems, typically refers to the system
>console, sometimes accessed via /dev/console, while a "terminal" is a
>more general term for a text-based interface, usually accessed via
>/dev/tty* or similar. (A typical user might never see the console.)

Although prior to running unix on PC's, all consoles were serial
terminals (or real teletypes or DECwriters), the only difference
between /dev/console and /dev/tty1
was that they were two different serial ports.

Re: Parsing multi-byte keystrokes

<xTgmM.111041$WpOe.4201@fx18.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=501&group=comp.lang.c%2B%2B#501

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!newsreader4.netcologne.de!news.netcologne.de!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx18.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Parsing multi-byte keystrokes
Newsgroups: comp.lang.c++
References: <u79ug0$i1ks$1@dont-email.me> <lZ3mM.83590$8uge.57668@fx14.iad> <u7bee1$sht9$3@dont-email.me>
Lines: 14
Message-ID: <xTgmM.111041$WpOe.4201@fx18.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Mon, 26 Jun 2023 14:02:05 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Mon, 26 Jun 2023 14:02:05 GMT
X-Received-Bytes: 1130
 by: Scott Lurndal - Mon, 26 Jun 2023 14:02 UTC

"R.Wieser" <address@is.invalid> writes:
>Scott,
>
>> $ man console_ioctl
>
>Yeah, I found that one too.
>
>Correct me if I'm wrong, but that looks like it only works for the local
>keyboard and won't be of much use in a remote session ...

There is no way to transmit keystroke metadata over a serial line generally,
so for anything other than the "console" terminal, all you get are ascii
characters.

Re: Parsing multi-byte keystrokes

<YUgmM.111042$WpOe.41294@fx18.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=502&group=comp.lang.c%2B%2B#502

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx18.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Parsing multi-byte keystrokes
Newsgroups: comp.lang.c++
References: <u79ug0$i1ks$1@dont-email.me> <Xm3mM.7635$3XE8.5950@fx42.iad> <u7bee1$sht9$2@dont-email.me>
Lines: 12
Message-ID: <YUgmM.111042$WpOe.41294@fx18.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Mon, 26 Jun 2023 14:03:36 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Mon, 26 Jun 2023 14:03:36 GMT
X-Received-Bytes: 999
 by: Scott Lurndal - Mon, 26 Jun 2023 14:03 UTC

"R.Wieser" <address@is.invalid> writes:
>Pavel,
>
>> On Linux (strictly speaking, on a GNU system) specifically, try readline
>> function.
>
>The problem with that is that I need the keys at the moment they are pressed
>(and released ?), not only after "enter" is pressed.

Ah, you want "raw" mode rather than "cooked" mode.

You can set that with tcsetattr(3).

Re: Parsing multi-byte keystrokes

<rWgmM.111043$WpOe.267@fx18.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=503&group=comp.lang.c%2B%2B#503

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx18.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Parsing multi-byte keystrokes
Newsgroups: comp.lang.c++
References: <u79ug0$i1ks$1@dont-email.me> <e992ebdc-2d53-4134-9cfd-fd9339c8ffe5n@googlegroups.com> <u7buf9$ue5n$3@dont-email.me>
Lines: 13
Message-ID: <rWgmM.111043$WpOe.267@fx18.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Mon, 26 Jun 2023 14:05:11 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Mon, 26 Jun 2023 14:05:11 GMT
X-Received-Bytes: 1141
 by: Scott Lurndal - Mon, 26 Jun 2023 14:05 UTC

"R.Wieser" <address@is.invalid> writes:
>Wij,
>
>[snip code]
>
>Thank you. Looking at the code I'm going to assume that receiving CTRL, ALT
>and SHIFT modifier keys too is just a setting added to the "ntio.iflag"
>field. I'll just have to check/find out which one it is. :-)

You cannot get CTRL, ALT and SHIFT modifier keys explicitly on serial
ports. The terminal applies them (well except for ALT, which is a PCism)
before transmitting the character over the serial line.

Re: Parsing multi-byte keystrokes

<u7can8$vt3t$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=504&group=comp.lang.c%2B%2B#504

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Mutt...@dastardlyhq.com
Newsgroups: comp.lang.c++
Subject: Re: Parsing multi-byte keystrokes
Date: Mon, 26 Jun 2023 15:26:32 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <u7can8$vt3t$1@dont-email.me>
References: <u79ug0$i1ks$1@dont-email.me> <Xm3mM.7635$3XE8.5950@fx42.iad><u7bee1$sht9$2@dont-email.me> <871qhy1usn.fsf@nosuchdomain.example.com> <u7buf9$ue5n$2@dont-email.me>
Injection-Date: Mon, 26 Jun 2023 15:26:32 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="dac3e8b1cf0791e5df69852aa9afbd3f";
logging-data="1045629"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18xdJYWzx0BEKRrjM7oqFLT"
Cancel-Lock: sha1:01XtSqqMalHce+TBScv8EECdwsU=
 by: Mutt...@dastardlyhq.com - Mon, 26 Jun 2023 15:26 UTC

On Mon, 26 Jun 2023 13:43:50 +0200
"R.Wieser" <address@is.invalid> wrote:
>Keith,
>
>> You might take a look at the readline source code to see how it
>> does that. It's certainly able to recognize the user pressing
>> up-arrow (which typically sends Esc-[-A) and acting on it
>> immediately, even if it doesn't expose that ability directly
>> to the user.
>
>As mentioned in my initial post, I have already switched the console input
>to "raw", and as such I can see bytes coming in when I press keys. Thats
>not the problem.
>
>What is is turning those streams of bytes into individual keystrokes. I can
>and already have parsed most keys for the "$TERM=linux" environment, but
>would like *NOT* to use my own code if something build-in is available - and
>getting support for other $TERM environments for free. :-)

Other than curses as someone has mentioned there's no library to process
keystrokes other than the code in the terminal/xterm/console itself. YOu'll
have to write your own. Tbh its not that hard , I did it for a telnet client
I wrote. There's a limited number of multibyte sequences you can expect
usually prepended with an ESC, eg "<esc>[A" is *usually* up arrow, "<esc>[B"
is *usually* down arrow. But some terminals can be awkward and send alternative
versions. The Linux console itself tends to differ from dumb terminals.

Re: Parsing multi-byte keystrokes

<u7cd2f$108ec$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=505&group=comp.lang.c%2B%2B#505

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: addr...@is.invalid (R.Wieser)
Newsgroups: comp.lang.c++
Subject: Re: Parsing multi-byte keystrokes
Date: Mon, 26 Jun 2023 17:46:07 +0200
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <u7cd2f$108ec$1@dont-email.me>
References: <u79ug0$i1ks$1@dont-email.me> <lZ3mM.83590$8uge.57668@fx14.iad> <u7bee1$sht9$3@dont-email.me> <xTgmM.111041$WpOe.4201@fx18.iad>
Injection-Date: Mon, 26 Jun 2023 16:06:39 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="3e13d070687dc98f7060108e206c1d81";
logging-data="1057228"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+hZ2VdFqsm5B2wAnYmioyLTdTvfSa248FcS9kyg7CtXA=="
Cancel-Lock: sha1:ceit2y0sndQ2bUacqjPUojauKk8=
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-Priority: 3
X-MSMail-Priority: Normal
 by: R.Wieser - Mon, 26 Jun 2023 15:46 UTC

Scott,

> There is no way to transmit keystroke metadata over a serial line
> generally,

Bullshit.

Regards,
Rudy Wieser

Re: Parsing multi-byte keystrokes

<u7cd2f$108ec$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=506&group=comp.lang.c%2B%2B#506

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: addr...@is.invalid (R.Wieser)
Newsgroups: comp.lang.c++
Subject: Re: Parsing multi-byte keystrokes
Date: Mon, 26 Jun 2023 17:49:10 +0200
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <u7cd2f$108ec$2@dont-email.me>
References: <u79ug0$i1ks$1@dont-email.me> <Xm3mM.7635$3XE8.5950@fx42.iad> <u7bee1$sht9$2@dont-email.me> <YUgmM.111042$WpOe.41294@fx18.iad>
Injection-Date: Mon, 26 Jun 2023 16:06:39 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="3e13d070687dc98f7060108e206c1d81";
logging-data="1057228"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/XVG6povtdokrd+xRnwcM+x2viJjROJKu4iRFNUyt1fg=="
Cancel-Lock: sha1:O2NAIkNtc2/XvdAGnA/fI/8ZIoA=
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
X-RFC2646: Format=Flowed; Original
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-Priority: 3
X-MSMail-Priority: Normal
 by: R.Wieser - Mon, 26 Jun 2023 15:49 UTC

Scott,

> Ah, you want "raw" mode rather than "cooked" mode.

Yes, but I already did that.

.... as I mentioned in the first line of my initial mesage.

Regards,
Rudy Wieser

Re: Parsing multi-byte keystrokes

<u7cd2g$108ec$3@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=507&group=comp.lang.c%2B%2B#507

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: addr...@is.invalid (R.Wieser)
Newsgroups: comp.lang.c++
Subject: Re: Parsing multi-byte keystrokes
Date: Mon, 26 Jun 2023 17:58:52 +0200
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <u7cd2g$108ec$3@dont-email.me>
References: <u79ug0$i1ks$1@dont-email.me> <e992ebdc-2d53-4134-9cfd-fd9339c8ffe5n@googlegroups.com> <u7buf9$ue5n$3@dont-email.me> <rWgmM.111043$WpOe.267@fx18.iad>
Injection-Date: Mon, 26 Jun 2023 16:06:40 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="3e13d070687dc98f7060108e206c1d81";
logging-data="1057228"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+6gU/jaaxubRDUx0dVMM0JHU8Zd0MpgC+n4Z/OXew7hg=="
Cancel-Lock: sha1:WfJU2kTnfJhv4uObd5hfc10/xKM=
X-MSMail-Priority: Normal
X-Priority: 3
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
 by: R.Wieser - Mon, 26 Jun 2023 15:58 UTC

Scott,

> You cannot get CTRL, ALT and SHIFT modifier keys explicitly on
> serial ports.

Is that what the parent of the message you are responding is talking about ?
I think not. So, what are you complaining about ?

Regards,
Rudy Wieser

Re: Parsing multi-byte keystrokes

<u7cd2g$108ec$4@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=508&group=comp.lang.c%2B%2B#508

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: addr...@is.invalid (R.Wieser)
Newsgroups: comp.lang.c++
Subject: Re: Parsing multi-byte keystrokes
Date: Mon, 26 Jun 2023 18:04:42 +0200
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <u7cd2g$108ec$4@dont-email.me>
References: <u79ug0$i1ks$1@dont-email.me> <Xm3mM.7635$3XE8.5950@fx42.iad><u7bee1$sht9$2@dont-email.me> <871qhy1usn.fsf@nosuchdomain.example.com> <u7buf9$ue5n$2@dont-email.me> <u7can8$vt3t$1@dont-email.me>
Injection-Date: Mon, 26 Jun 2023 16:06:40 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="3e13d070687dc98f7060108e206c1d81";
logging-data="1057228"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/UYZNbSzGMNVCaMLKu7WMdp19BOrxm2PPE0EAEMSKNZw=="
Cancel-Lock: sha1:aD24+4aEhjG8YACqz9vRsuTsUNo=
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-Priority: 3
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
X-RFC2646: Format=Flowed; Original
 by: R.Wieser - Mon, 26 Jun 2023 16:04 UTC

Muttley,

> YOu'll have to write your own. Tbh its not that hard

I already did. But I would like to replace it with something that has been
time tested, as well as being able to cope with a number of other $TERM
types.

Regards,
Rudy Wieser

Re: Parsing multi-byte keystrokes

<874jmu2lbn.fsf@bsb.me.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=509&group=comp.lang.c%2B%2B#509

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c++
Subject: Re: Parsing multi-byte keystrokes
Date: Mon, 26 Jun 2023 18:19:08 +0100
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <874jmu2lbn.fsf@bsb.me.uk>
References: <u79ug0$i1ks$1@dont-email.me> <lZ3mM.83590$8uge.57668@fx14.iad>
<u7bee1$sht9$3@dont-email.me> <xTgmM.111041$WpOe.4201@fx18.iad>
<u7cd2f$108ec$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="30bd7937b87860f973277a7390f3a6b0";
logging-data="1078296"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+R6YYKrHxN0dm+rvx7IskqrAULVTZ0WGM="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:TRzbqt3gtwZ/ZXl3SBcSAriXM6M=
sha1:2KovGpbz7IVDbE3eyHfgXhRrsZ0=
X-BSB-Auth: 1.a465f3948c3aaa460c54.20230626181908BST.874jmu2lbn.fsf@bsb.me.uk
 by: Ben Bacarisse - Mon, 26 Jun 2023 17:19 UTC

"R.Wieser" <address@is.invalid> writes:

> Scott,
>
>> There is no way to transmit keystroke metadata over a serial line
>> generally,
>
> Bullshit.

Rather than jump to this sort of conclusion, why not ask about what
Scott said?

Lots of terminals that you used to plug into a serial line simply sent a
sequence of processed characters to the other end. By "keystroke
metadata" I presume Scott means things like "left shift key down" or,
more likely, "key F12 while shift and control down" won't get sent.
Thus historical terminal interfaces would assume that only the processed
character sequence generated by the terminal hardware can be handled.

--
Ben.

Re: Parsing multi-byte keystrokes

<u7chlc$110vd$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=510&group=comp.lang.c%2B%2B#510

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: addr...@is.invalid (R.Wieser)
Newsgroups: comp.lang.c++
Subject: Re: Parsing multi-byte keystrokes
Date: Mon, 26 Jun 2023 19:24:48 +0200
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <u7chlc$110vd$1@dont-email.me>
References: <u79ug0$i1ks$1@dont-email.me> <e992ebdc-2d53-4134-9cfd-fd9339c8ffe5n@googlegroups.com>
Injection-Date: Mon, 26 Jun 2023 17:25:00 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="3e13d070687dc98f7060108e206c1d81";
logging-data="1082349"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/msEtf5aYWyhPSfQx9vOQh8g4owfNXmN+IdXChllQpPQ=="
Cancel-Lock: sha1:aDgl3jr9f3pGOc85wI5INwcrWCM=
X-RFC2646: Format=Flowed; Original
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-Priority: 3
 by: R.Wieser - Mon, 26 Jun 2023 17:24 UTC

wij,

[snip code]

Alas. Although I've set the exact flags you've shown I only get the normal
"del" (and other keys), regardless of which modifier keys I also press.

Any idea why ? $TERM setting perhaps (mine is "linux").

Regards,
Rudy Wieser

Re: Parsing multi-byte keystrokes

<RUkmM.12275$33q9.1709@fx35.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=511&group=comp.lang.c%2B%2B#511

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx35.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Parsing multi-byte keystrokes
Newsgroups: comp.lang.c++
References: <u79ug0$i1ks$1@dont-email.me> <lZ3mM.83590$8uge.57668@fx14.iad> <u7bee1$sht9$3@dont-email.me> <xTgmM.111041$WpOe.4201@fx18.iad> <u7cd2f$108ec$1@dont-email.me> <874jmu2lbn.fsf@bsb.me.uk>
Lines: 27
Message-ID: <RUkmM.12275$33q9.1709@fx35.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Mon, 26 Jun 2023 18:36:33 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Mon, 26 Jun 2023 18:36:33 GMT
X-Received-Bytes: 1766
 by: Scott Lurndal - Mon, 26 Jun 2023 18:36 UTC

Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>"R.Wieser" <address@is.invalid> writes:
>
>> Scott,
>>
>>> There is no way to transmit keystroke metadata over a serial line
>>> generally,
>>
>> Bullshit.
>
>Rather than jump to this sort of conclusion, why not ask about what
>Scott said?
>
>Lots of terminals that you used to plug into a serial line simply sent a
>sequence of processed characters to the other end. By "keystroke
>metadata" I presume Scott means things like "left shift key down" or,
>more likely, "key F12 while shift and control down" won't get sent.
>Thus historical terminal interfaces would assume that only the processed
>character sequence generated by the terminal hardware can be handled.

Correct. I also qualified the statement with 'generally'.

R didn't specify (other than the generic 'console terminal')
anything about the other end of the 'terminal' - whether it is
an antique glass tty on a 9600 baud serial port, or the other
end of a psuedo-terminal pair, or a kernel console driver.

Re: Parsing multi-byte keystrokes

<87wmzqyro2.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=512&group=comp.lang.c%2B%2B#512

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c++
Subject: Re: Parsing multi-byte keystrokes
Date: Mon, 26 Jun 2023 12:01:01 -0700
Organization: None to speak of
Lines: 32
Message-ID: <87wmzqyro2.fsf@nosuchdomain.example.com>
References: <u79ug0$i1ks$1@dont-email.me> <Xm3mM.7635$3XE8.5950@fx42.iad>
<u7bee1$sht9$2@dont-email.me>
<871qhy1usn.fsf@nosuchdomain.example.com>
<u7buf9$ue5n$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="a44f767d52f7a9230c899799d3560062";
logging-data="1104438"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Suxs8Qcp3PyrLMdVej3gZ"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:f7yuCAQOS35yjjPNCqQUryNxAEc=
sha1:9r46qObaMvD4qIG+K8JevCY9jaw=
 by: Keith Thompson - Mon, 26 Jun 2023 19:01 UTC

"R.Wieser" <address@is.invalid> writes:
> Keith,

Your newsreader should add attribution lines, like the
"R.Wieser" <address@is.invalid> writes:
line above. Please don't delete those lines. They're there to
show readers who wrote what.

>> You might take a look at the readline source code to see how it
>> does that. It's certainly able to recognize the user pressing
>> up-arrow (which typically sends Esc-[-A) and acting on it
>> immediately, even if it doesn't expose that ability directly
>> to the user.
>
> As mentioned in my initial post, I have already switched the console input
> to "raw", and as such I can see bytes coming in when I press keys. Thats
> not the problem.

So if the user presses the up-arrow key, you see three bytes: Escape,
'[', and 'A', right? And you want to recognize that sequence as
"up-arrow"? I'm saying that readline does exactly that internally, and
examing the readline source code might be helpful.

> What is is turning those streams of bytes into individual keystrokes. I can
> and already have parsed most keys for the "$TERM=linux" environment, but
> would like *NOT* to use my own code if something build-in is available - and
> getting support for other $TERM environments for free. :-)

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: Parsing multi-byte keystrokes

<87sfaeyrbu.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=513&group=comp.lang.c%2B%2B#513

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c++
Subject: Re: Parsing multi-byte keystrokes
Date: Mon, 26 Jun 2023 12:08:21 -0700
Organization: None to speak of
Lines: 17
Message-ID: <87sfaeyrbu.fsf@nosuchdomain.example.com>
References: <u79ug0$i1ks$1@dont-email.me> <lZ3mM.83590$8uge.57668@fx14.iad>
<87ilbb13tu.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="a44f767d52f7a9230c899799d3560062";
logging-data="1104438"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+U6tgX8lDPdcMPTpxWKFqk"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:XlVWExE45ejjsOS19e9H93E6i7k=
sha1:hBuJUJsoRDfcTmNIQWHJ90reGm4=
 by: Keith Thompson - Mon, 26 Jun 2023 19:08 UTC

Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
> scott@slp53.sl.home (Scott Lurndal) writes:
[...]
>> $ man console_ioctl
>
> I believe that only applies to the Linux system console (the text-only
> interface you typically get by typing Ctrl-Alt-N, where N is a small
> integer). I know the OP wrote "console", but I suspect they're looking
> for something that works on a terminal emulator.

My mistake, the Linux virtual consoles are accessed via Alt-FN or
Ctrl-Alt-FN (function keys), where N is a small integer.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: Parsing multi-byte keystrokes

<87o7l2yqvo.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=514&group=comp.lang.c%2B%2B#514

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c++
Subject: Re: Parsing multi-byte keystrokes
Date: Mon, 26 Jun 2023 12:18:03 -0700
Organization: None to speak of
Lines: 43
Message-ID: <87o7l2yqvo.fsf@nosuchdomain.example.com>
References: <u79ug0$i1ks$1@dont-email.me> <lZ3mM.83590$8uge.57668@fx14.iad>
<87ilbb13tu.fsf@nosuchdomain.example.com>
<u7bee2$sht9$5@dont-email.me>
<877crq1va9.fsf@nosuchdomain.example.com>
<u7buf8$ue5n$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="a44f767d52f7a9230c899799d3560062";
logging-data="1104438"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/YXZBS/uCWHOkWdPEukoA6"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:VmBFNudyzcpIM0s5aTTTKlujGWI=
sha1:Q4r8VzyADCBySWcPcidCzkdABoE=
 by: Keith Thompson - Mon, 26 Jun 2023 19:18 UTC

"R.Wieser" <address@is.invalid> writes:
> Keith,
>
>> The term "console", on Unix-like systems, typically refers to the
>> system console, sometimes accessed via /dev/console, while a "terminal"
>> is a more general term for a text-based interface, usually accessed via
>> /dev/tty* or similar. (A typical user might never see the console.)
>
> As I said, the difference between them is /at best/ confusing. That you
> than introduce "system console" without offering any explanation to it does
> not help either. :-|

Apparently it helped you to find more information.

> I found a link which says that all things are terminals, and that a console
> is just a special one (your "system console").
>
> In that case I'm working on/in the system console.
>
> Though I'm going to have a hard time remembering that ALT F1 is a console,
> but that ALT F2...F6 are terminals (I probably, likely won't. Too little,
> if any, distinction).

It's fairly common to use the word "console" (perhaps incorrectly) to
refer to terminals in general.

On Linux-based systems, and probably others, all the Alt-FN screens are
*virtual consoles*. They're supported by the OS more or less directly,
and they don't depend on any GUI system like X11. Terminal emulators
typically run as windows under X11 (or Wayland, or whatever).

And since this is all specific to Unix-like systems, and perhaps more
specifically to Linux-based systems, you might get better information in
a Unix-specific newsgroup, perhaps comp.unix.programmer. (This is
comp.lang.c++, and I don't think I've seen any C++ code in this thread,
and the libraries we've been discussing are C, not C++.)

[...]

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: Parsing multi-byte keystrokes

<87jzvqyqm3.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=515&group=comp.lang.c%2B%2B#515

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c++
Subject: Re: Parsing multi-byte keystrokes
Date: Mon, 26 Jun 2023 12:23:48 -0700
Organization: None to speak of
Lines: 23
Message-ID: <87jzvqyqm3.fsf@nosuchdomain.example.com>
References: <u79ug0$i1ks$1@dont-email.me> <Xm3mM.7635$3XE8.5950@fx42.iad>
<u7bee1$sht9$2@dont-email.me> <YUgmM.111042$WpOe.41294@fx18.iad>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="a44f767d52f7a9230c899799d3560062";
logging-data="1104438"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX182gfwImB8CD92p8cIpzGdX"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:XWUASNJCiD0KyMyr6RzSSVe1XIQ=
sha1:SJ+9kWyC968XiYWhOOGIT6YlLwc=
 by: Keith Thompson - Mon, 26 Jun 2023 19:23 UTC

scott@slp53.sl.home (Scott Lurndal) writes:
> "R.Wieser" <address@is.invalid> writes:
>>Pavel,
>>
>>> On Linux (strictly speaking, on a GNU system) specifically, try readline
>>> function.
>>
>>The problem with that is that I need the keys at the moment they are pressed
>>(and released ?), not only after "enter" is pressed.
>
> Ah, you want "raw" mode rather than "cooked" mode.
>
> You can set that with tcsetattr(3).

I think R.Wieser was saying that readline doesn't give any information
to the client until you press "enter" -- not because readline uses
cooked mode, but because readline presents a line-oriented interface.
(But examining the readline source code might be useful.)

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: Parsing multi-byte keystrokes

<u7colu$122dt$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=516&group=comp.lang.c%2B%2B#516

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: addr...@is.invalid (R.Wieser)
Newsgroups: comp.lang.c++
Subject: Re: Parsing multi-byte keystrokes
Date: Mon, 26 Jun 2023 21:24:26 +0200
Organization: A noiseless patient Spider
Lines: 55
Message-ID: <u7colu$122dt$1@dont-email.me>
References: <u79ug0$i1ks$1@dont-email.me> <lZ3mM.83590$8uge.57668@fx14.iad><u7bee1$sht9$3@dont-email.me> <xTgmM.111041$WpOe.4201@fx18.iad><u7cd2f$108ec$1@dont-email.me> <874jmu2lbn.fsf@bsb.me.uk>
Injection-Date: Mon, 26 Jun 2023 19:24:46 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="3e13d070687dc98f7060108e206c1d81";
logging-data="1116605"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/kuJkakt4IGu7BdiU5XfkXf3Dz0LPhARUXEThcp8yRyg=="
Cancel-Lock: sha1:+MGRfg9d4T9WtotHN3wWyiHPnWY=
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
X-RFC2646: Format=Flowed; Original
 by: R.Wieser - Mon, 26 Jun 2023 19:24 UTC

Ben,

>>> There is no way to transmit keystroke metadata over a serial line
>>> generally,
>>
>> Bullshit.
>
> Rather than jump to this sort of conclusion, why not ask about what
> Scott said?

Because I'm getting tired of people who say one thing, but (bloody likely)
mean something *completely* different. And I mean *completely*.

I could ask him. I could even tell him what he (likely) tried to say
instead.

But no. It would be me fighting to get him to say what he actually means,
and I do not care for yet another struggle like that *at all*.

> By "keystroke metadata" I presume Scott means things like "left shift key
> down" or,
> more likely, "key F12 while shift and control down" won't get sent.

Yeah, I figured that its /possible/ that that is what he ment.

But if that is actually what he ment (our guesswork!) than you get the next
problem : By whom/what ?

How many terminal programs does he know of and has checked for that
behaviour ? how many *doesn't* he know and might do just that (absense of
proof is not proof of absense) ? In that regard his reply is *way* to
absolute for its own good.

> Thus historical terminal interfaces would assume that only the
> processed character sequence generated by the terminal hardware
> can be handled.

Disagree. It will, rather likely, make sure that unknown sequences are
silently discarded - leaving it up to newer parsers to handle the extra,
newer keys too.

Think of that as similar to old-style keyboards, and the newer ones with a
slew of fancy keys at the top to shut down the 'puter, change volume, call
up the default browser, etc. An old OS will just ignore those extra keys.

IOW, although I've not yet seen such modifier-key sequences come by, I could
easily imagine that they can be enabled, or that the modifier keys become
part of the keystroke packet as an extra field.

Regards,
Rudy Wieser

Re: Parsing multi-byte keystrokes

<u7csb8$12hso$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=517&group=comp.lang.c%2B%2B#517

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: aurio...@gmx.de (Christian Gollwitzer)
Newsgroups: comp.lang.c++
Subject: Re: Parsing multi-byte keystrokes
Date: Mon, 26 Jun 2023 22:27:20 +0200
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <u7csb8$12hso$1@dont-email.me>
References: <u79ug0$i1ks$1@dont-email.me> <Xm3mM.7635$3XE8.5950@fx42.iad>
<87edlz5cax.fsf@bsb.me.uk> <u7bee2$sht9$4@dont-email.me>
<877crq4cbp.fsf@bsb.me.uk> <u7c3qt$v2jh$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 26 Jun 2023 20:27:21 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="97c8d488b537bebb57da30d6a7f12760";
logging-data="1132440"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18aJ3CO5GrOdwBE07F+yQIhLa2ven8kMs0="
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.12.0
Cancel-Lock: sha1:dRZgR2J5aGTtY6yth6FKsuapv4k=
In-Reply-To: <u7c3qt$v2jh$1@dont-email.me>
 by: Christian Gollwitzer - Mon, 26 Jun 2023 20:27 UTC

Am 26.06.23 um 15:03 schrieb R.Wieser:
>> There used to be libraries built on top of curses (and/or ncurses)
>> that provided higher-level user interaction widgets like this.
>
> I'm not looking for specifically the widgets (the example was just that,
> something to be able to relate to), but for how to be able to do something
> interactive with the keyboard. And for that I need to be able to extract
> keystrokes from the input stream.

As written above, you can use the termcap or terminfo library. It tells
you what keystrokes correspond to which keys.

Christian

Re: Parsing multi-byte keystrokes

<u7ctib$12pk1$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=518&group=comp.lang.c%2B%2B#518

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: addr...@is.invalid (R.Wieser)
Newsgroups: comp.lang.c++
Subject: Re: Parsing multi-byte keystrokes
Date: Mon, 26 Jun 2023 21:59:13 +0200
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <u7ctib$12pk1$1@dont-email.me>
References: <u79ug0$i1ks$1@dont-email.me> <Xm3mM.7635$3XE8.5950@fx42.iad><u7bee1$sht9$2@dont-email.me><871qhy1usn.fsf@nosuchdomain.example.com><u7buf9$ue5n$2@dont-email.me> <87wmzqyro2.fsf@nosuchdomain.example.com>
Injection-Date: Mon, 26 Jun 2023 20:48:11 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="3e13d070687dc98f7060108e206c1d81";
logging-data="1140353"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18PchUoJOg4H863tP0KXx6I7YDNYaDjhOBiynt4n5XQZw=="
Cancel-Lock: sha1:LVSRqyfhCWSeV4I6osABptr66kQ=
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
X-RFC2646: Format=Flowed; Original
X-Priority: 3
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
 by: R.Wieser - Mon, 26 Jun 2023 19:59 UTC

Keith,

> Your newsreader should add attribution lines, like the
> "R.Wieser" <address@is.invalid> writes:
> line above. Please don't delete those lines. They're there
> to show readers who wrote what.

Thats why I have name the person I'm talking to at the top of my message -
just like yours now.

Also, my newsreader is more than 20 years old, and even it has got a tree
view with which I can easily go backwards to parent messages and forwards to
replies to my posts. I seldom-if-ever use it though. I could imagine that
yours has the same capability.

> So if the user presses the up-arrow key, you see three bytes: Escape,
> '[', and 'A', right? And you want to recognize that sequence as
> "up-arrow"? I'm saying that readline does exactly that internally,
> and examing the readline source code might be helpful.

As mentioned in my initial post, I already wrote a parser. But I would like
to replace it with something build-in, which is likely to support other
$TERMs than just "linux". If a build-in method doesn't exist I will just
continue using what I currently have.

Regards,
Rudy Wieser

Re: Parsing multi-byte keystrokes

<u7ctib$12pk1$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=519&group=comp.lang.c%2B%2B#519

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: addr...@is.invalid (R.Wieser)
Newsgroups: comp.lang.c++
Subject: Re: Parsing multi-byte keystrokes
Date: Mon, 26 Jun 2023 22:37:58 +0200
Organization: A noiseless patient Spider
Lines: 49
Message-ID: <u7ctib$12pk1$2@dont-email.me>
References: <u79ug0$i1ks$1@dont-email.me> <lZ3mM.83590$8uge.57668@fx14.iad><87ilbb13tu.fsf@nosuchdomain.example.com><u7bee2$sht9$5@dont-email.me><877crq1va9.fsf@nosuchdomain.example.com><u7buf8$ue5n$1@dont-email.me> <87o7l2yqvo.fsf@nosuchdomain.example.com>
Injection-Date: Mon, 26 Jun 2023 20:48:11 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="3e13d070687dc98f7060108e206c1d81";
logging-data="1140353"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/jcBnTE7wVv5+QUcX3Y/NFP78+jnXkTi6AmqUSWXC2sw=="
Cancel-Lock: sha1:Cg5eZ8TAbT2G90+rU3EkX1D4rPQ=
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-Priority: 3
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
 by: R.Wieser - Mon, 26 Jun 2023 20:37 UTC

Keith,

>> As I said, the difference between them is /at best/ confusing. That you
>> than introduce "system console" without offering any explanation to it
>> does
>> not help either. :-|
>
> Apparently it helped you to find more information.

No, it didn't. I could not care less about what, on my machine, the
difference is between a "system console" and a "console". But I *had* to
search for it, because it *could* have been of importance in regard to the
distinction between a "console" and a "terminal". It wasn't. IOW, I wasted
my time.

> It's fairly common to use the word "console" (perhaps incorrectly)
> to refer to terminals in general.

Thats what I said. They are pretty-much used interchangably.

Currently I still do not know with what I should refer to the
console/terminal/tty/whatever on which the boot-process outputs its progress
and I than use to program in. Or with what I should refer to the ones under
ALT F2...F6.

> Terminal emulators typically run as windows under X11 (or Wayland,
> or whatever).

Any reason for the "emulator" postfix ? Other than by habit I mean ? And
yes, I recognise that a console in a window puts character based content in
a pixel-based environment.

To be honest, I took the "terminal emulator" as being a /program/ which runs
on another computer, translating whatever it gets into screen output, and
translates keyboard input to whatever the other side needs (VT100 codes or
alike).

> And since this is all specific to Unix-like systems, and perhaps more
> specifically to Linux-based systems, you might get better information
> in a Unix-specific newsgroup, perhaps comp.unix.programmer.

I was assuming that there would be linux programmers here too.

But a good one, thanks.

Regards,
Rudy Wieser

Re: Parsing multi-byte keystrokes

<u7ctic$12pk1$3@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=520&group=comp.lang.c%2B%2B#520

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: addr...@is.invalid (R.Wieser)
Newsgroups: comp.lang.c++
Subject: Re: Parsing multi-byte keystrokes
Date: Mon, 26 Jun 2023 22:48:00 +0200
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <u7ctic$12pk1$3@dont-email.me>
References: <u79ug0$i1ks$1@dont-email.me> <Xm3mM.7635$3XE8.5950@fx42.iad> <87edlz5cax.fsf@bsb.me.uk> <u7bee2$sht9$4@dont-email.me> <877crq4cbp.fsf@bsb.me.uk> <u7c3qt$v2jh$1@dont-email.me> <u7csb8$12hso$1@dont-email.me>
Injection-Date: Mon, 26 Jun 2023 20:48:12 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="3e13d070687dc98f7060108e206c1d81";
logging-data="1140353"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+y2Vn1QTzxq6+vlBi7sf9MZNkjziWDNI3Y51QFlSXUmw=="
Cancel-Lock: sha1:CT2+j0JdKoMr40PK3R4AbEsobV8=
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
X-RFC2646: Format=Flowed; Response
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-Priority: 3
X-MSMail-Priority: Normal
 by: R.Wieser - Mon, 26 Jun 2023 20:48 UTC

Christian,

> As written above, you can use the termcap or terminfo library. It tells
> you what keystrokes correspond to which keys.

A quick search shows me that "termcap" is a textfile which as been marked
obsolete and that both are used to translate keystrokes into escape
sequences. There where no results shown in regard to translating escape
sequences back to keystrokes though.

IOW, do you have any link(s) that show how the latter is supposed to be done
?

Regards,
Rudy Wieser


devel / comp.lang.c++ / Parsing multi-byte keystrokes

Pages:123456
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor