Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #90713 > unrolled thread

Parsing multi-byte keystrokes

Started by"R.Wieser" <address@is.invalid>
First post2023-06-25 19:45 +0200
Last post2023-06-26 19:24 +0200
Articles 20 on this page of 143 — 19 participants

Back to article view | Back to comp.lang.c++


Contents

  Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-25 19:45 +0200
    Re: Parsing multi-byte keystrokes "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2023-06-25 20:34 +0200
      Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-25 21:39 +0200
      Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-25 15:06 -0700
        Re: Parsing multi-byte keystrokes Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2023-06-25 20:18 -0400
          Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-25 19:10 -0700
        Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 08:46 +0200
    Re: Parsing multi-byte keystrokes Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2023-06-25 18:39 -0400
      Re: Parsing multi-byte keystrokes Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-06-26 00:53 +0100
        Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 09:11 +0200
          Re: Parsing multi-byte keystrokes Christian Gollwitzer <auriocus@gmx.de> - 2023-06-26 09:32 +0200
          Re: Parsing multi-byte keystrokes Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-06-26 13:50 +0100
            Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 15:03 +0200
              Re: Parsing multi-byte keystrokes Christian Gollwitzer <auriocus@gmx.de> - 2023-06-26 22:27 +0200
                Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 22:48 +0200
                  Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-26 14:35 -0700
                  Re: Parsing multi-byte keystrokes Christian Gollwitzer <auriocus@gmx.de> - 2023-06-26 23:58 +0200
                    Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-26 16:26 -0700
      Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 08:50 +0200
        Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-26 01:39 -0700
          Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 13:43 +0200
            Re: Parsing multi-byte keystrokes Muttley@dastardlyhq.com - 2023-06-26 15:26 +0000
              Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 18:04 +0200
            Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-26 12:01 -0700
              Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 21:59 +0200
                Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-26 14:15 -0700
                Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-06-26 22:35 +0000
                  Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-29 13:15 +0200
        Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-06-26 14:03 +0000
          Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 17:49 +0200
          Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-26 12:23 -0700
        Re: Parsing multi-byte keystrokes red floyd <no.spam.here@its.invalid> - 2023-06-28 14:35 -0700
          Re: Parsing multi-byte keystrokes gazelle@shell.xmission.com (Kenny McCormack) - 2023-06-29 00:17 +0000
            Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-06-29 00:43 +0000
              Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-29 14:04 +0200
                Re: Parsing multi-byte keystrokes gazelle@shell.xmission.com (Kenny McCormack) - 2023-06-29 15:44 +0000
                  Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-29 18:37 +0200
                    Re: Parsing multi-byte keystrokes Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-06-30 14:14 +0100
                      Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-30 18:12 +0200
                        Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-30 20:32 +0200
                        Re: Parsing multi-byte keystrokes Paavo Helde <eesnimi@osa.pri.ee> - 2023-06-30 22:57 +0300
                          Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-07-01 09:49 +0200
                        Re: Parsing multi-byte keystrokes Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-06-30 21:36 +0100
                        Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-30 13:45 -0700
                          Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-07-01 10:33 +0200
                            Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-07-01 11:58 -0700
                              Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-07-02 11:03 +0200
                                Re: Parsing multi-byte keystrokes Christian Gollwitzer <auriocus@gmx.de> - 2023-07-02 23:15 +0200
                                  Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-07-03 09:12 +0200
                                Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-07-02 15:39 -0700
                                  Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-07-03 10:12 +0200
                                    Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-07-03 13:28 +0000
                                    Re: Parsing multi-byte keystrokes James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-07-03 12:43 -0400
                                Re: Parsing multi-byte keystrokes Muttley@dastardlyhq.com - 2023-07-03 15:41 +0000
                                  Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-07-03 21:32 +0200
                                    Re: Parsing multi-byte keystrokes gazelle@shell.xmission.com (Kenny McCormack) - 2023-07-03 21:06 +0000
                                    Re: Parsing multi-byte keystrokes James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-07-04 05:20 -0400
                                      Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-07-04 13:56 +0000
                                        Re: Parsing multi-byte keystrokes James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-07-04 16:03 -0400
                                          Re: Parsing multi-byte keystrokes kalevi@kolttonen.fi (Kalevi Kolttonen) - 2023-07-04 21:03 +0000
                                            Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-07-04 14:33 -0700
                                              Re: Parsing multi-byte keystrokes kalevi@kolttonen.fi (Kalevi Kolttonen) - 2023-07-04 21:55 +0000
                                                Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-07-05 13:58 +0000
                                            Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-07-05 13:56 +0000
                                    Re: Parsing multi-byte keystrokes Muttley@dastardlyhq.com - 2023-07-04 15:54 +0000
                                      Re: Parsing multi-byte keystrokes David Brown <david.brown@hesbynett.no> - 2023-07-04 18:03 +0200
                                        Re: Parsing multi-byte keystrokes kalevi@kolttonen.fi (Kalevi Kolttonen) - 2023-07-04 16:33 +0000
                                          Re: Parsing multi-byte keystrokes gazelle@shell.xmission.com (Kenny McCormack) - 2023-07-04 16:41 +0000
                                            Re: Parsing multi-byte keystrokes kalevi@kolttonen.fi (Kalevi Kolttonen) - 2023-07-04 16:52 +0000
                                          Re: Parsing multi-byte keystrokes David Brown <david.brown@hesbynett.no> - 2023-07-05 09:50 +0200
                                            Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-07-05 14:00 +0000
                                            Re: Parsing multi-byte keystrokes "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-07-05 11:21 -0700
                                              Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-07-05 20:24 +0000
                                            Re: Parsing multi-byte keystrokes kalevi@kolttonen.fi (Kalevi Kolttonen) - 2023-07-05 19:31 +0000
                                        Re: Parsing multi-byte keystrokes Muttley@dastardlyhq.com - 2023-07-04 19:05 +0000
                                      Re: Parsing multi-byte keystrokes red floyd <no.spam.here@its.invalid> - 2023-07-05 18:31 -0700
                                        Cars (Was: Parsing what is Linux?) gazelle@shell.xmission.com (Kenny McCormack) - 2023-07-06 08:40 +0000
                                        Re: Parsing multi-byte keystrokes Muttley@dastardlyhq.com - 2023-07-06 08:55 +0000
                                          Cars (Was: Parsing multi-byte keystrokes) gazelle@shell.xmission.com (Kenny McCormack) - 2023-07-06 09:27 +0000
                                            Re: Cars (Was: Parsing multi-byte keystrokes) Muttley@dastardlyhq.com - 2023-07-06 15:43 +0000
                                              Totally insane (Was: Cars (Was: Parsing multi-byte keystrokes)) gazelle@shell.xmission.com (Kenny McCormack) - 2023-07-06 16:53 +0000
                                                Re: Totally insane (Was: Cars (Was: Parsing multi-byte keystrokes)) Muttley@dastardlyhq.com - 2023-07-07 07:15 +0000
                        Re: Parsing multi-byte keystrokes James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-06-30 17:00 -0400
                          Re: Parsing multi-byte keystrokes gazelle@shell.xmission.com (Kenny McCormack) - 2023-07-01 07:53 +0000
                          Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-07-01 10:30 +0200
                            Re: Parsing multi-byte keystrokes James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-07-02 04:04 -0400
                              Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-07-02 11:27 +0200
                                Re: Parsing multi-byte keystrokes James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-07-02 14:51 -0400
                                  Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-07-02 22:49 +0200
                                    Re: Parsing multi-byte keystrokes James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-07-02 18:56 -0400
                                      Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-07-03 10:59 +0200
                                        Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-07-03 13:34 +0000
                                        Re: Parsing multi-byte keystrokes James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-07-03 12:20 -0400
                                          Re: Parsing multi-byte keystrokes Richard Harnden <richard.nospam@gmail.com> - 2023-07-03 18:02 +0100
                                            Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-07-03 14:40 -0700
                                          Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-07-03 22:50 +0200
                                            Re: Parsing multi-byte keystrokes James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-07-04 05:47 -0400
                                          Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-07-03 14:36 -0700
                            Re: Parsing multi-byte keystrokes David Brown <david.brown@hesbynett.no> - 2023-07-03 11:38 +0200
                              Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-07-03 13:04 +0200
                                Re: Parsing multi-byte keystrokes David Brown <david.brown@hesbynett.no> - 2023-07-03 15:11 +0200
                                Re: Parsing multi-byte keystrokes Christian Gollwitzer <auriocus@gmx.de> - 2023-07-03 20:35 +0200
                                  Re: Parsing multi-byte keystrokes gazelle@shell.xmission.com (Kenny McCormack) - 2023-07-03 19:16 +0000
                                  Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-07-03 22:55 +0200
                          Re: Parsing multi-byte keystrokes Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-07-01 03:03 -0700
                            Re: Parsing multi-byte keystrokes Muttley@dastardlyhq.com - 2023-07-01 10:30 +0000
                    Re: Parsing multi-byte keystrokes "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2023-07-01 22:37 +0200
                      Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-07-02 09:42 +0200
        Re: Parsing multi-byte keystrokes Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2023-06-29 22:21 -0400
          Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-30 17:50 +0200
    Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-06-25 23:20 +0000
      Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-25 17:10 -0700
        Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 09:21 +0200
          Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-26 01:29 -0700
            Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 13:30 +0200
              Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-26 12:18 -0700
                Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 22:37 +0200
                  Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-26 14:32 -0700
                  Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-06-26 22:41 +0000
                    Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-29 13:58 +0200
                      Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-29 13:59 -0700
          Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-26 01:30 -0700
            Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-06-26 14:00 +0000
          Re: Parsing multi-byte keystrokes "Fred. Zwarts" <F.Zwarts@HetNet.nl> - 2023-06-26 12:31 +0200
            Re: Parsing multi-byte keystrokes "Fred. Zwarts" <F.Zwarts@HetNet.nl> - 2023-06-26 12:47 +0200
            Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 13:56 +0200
        Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-06-26 13:58 +0000
        Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-26 12:08 -0700
      Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 08:56 +0200
        Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-06-26 14:02 +0000
          Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 17:46 +0200
            Re: Parsing multi-byte keystrokes Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-06-26 18:19 +0100
              Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-06-26 18:36 +0000
              Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 21:24 +0200
                Re: Parsing multi-byte keystrokes Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-06-26 22:12 +0100
    Re: Parsing multi-byte keystrokes wij <wyniijj5@gmail.com> - 2023-06-26 02:06 -0700
      Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 13:49 +0200
        Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-06-26 14:05 +0000
          Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 17:58 +0200
        Re: Parsing multi-byte keystrokes wij <wyniijj5@gmail.com> - 2023-06-27 13:32 -0700
          Re: Parsing multi-byte keystrokes gazelle@shell.xmission.com (Kenny McCormack) - 2023-06-28 02:17 +0000
            Re: Parsing multi-byte keystrokes wij <wyniijj5@gmail.com> - 2023-06-27 20:26 -0700
      Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 19:24 +0200

Page 2 of 8 — ← Prev page 1 [2] 3 4 5 6 7 8  Next page →


#90736

From"R.Wieser" <address@is.invalid>
Date2023-06-26 13:43 +0200
Message-ID<u7buf9$ue5n$2@dont-email.me>
In reply to#90731
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. :-)

Regards,
Rudy Wieser

[toc] | [prev] | [next] | [standalone]


#90746

FromMuttley@dastardlyhq.com
Date2023-06-26 15:26 +0000
Message-ID<u7can8$vt3t$1@dont-email.me>
In reply to#90736
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.

[toc] | [prev] | [next] | [standalone]


#90750

From"R.Wieser" <address@is.invalid>
Date2023-06-26 18:04 +0200
Message-ID<u7cd2g$108ec$4@dont-email.me>
In reply to#90746
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

[toc] | [prev] | [next] | [standalone]


#90754

FromKeith Thompson <Keith.S.Thompson+u@gmail.com>
Date2023-06-26 12:01 -0700
Message-ID<87wmzqyro2.fsf@nosuchdomain.example.com>
In reply to#90736
"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 */

[toc] | [prev] | [next] | [standalone]


#90760

From"R.Wieser" <address@is.invalid>
Date2023-06-26 21:59 +0200
Message-ID<u7ctib$12pk1$1@dont-email.me>
In reply to#90754
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

[toc] | [prev] | [next] | [standalone]


#90764

FromKeith Thompson <Keith.S.Thompson+u@gmail.com>
Date2023-06-26 14:15 -0700
Message-ID<87fs6dzzzv.fsf@nosuchdomain.example.com>
In reply to#90760
"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.
>
> Thats why I have name the person I'm talking to at the top of my message - 
> just like yours now.

Yes, I understand what you're doing and why you're doing it.

I'm asking you not to do that.  I'm asking you to leave the generated
attribution lines in place, as everyone else here does.  You're
expending extra effort and making your articles more difficult to read.

[...]

>> 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.

If there is such an existing library, comp.lang.c++ is not the place to
ask about it.  Nothing you've written here is specific to 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 */

[toc] | [prev] | [next] | [standalone]


#90768

Fromscott@slp53.sl.home (Scott Lurndal)
Date2023-06-26 22:35 +0000
Message-ID<gpomM.8406$JLp4.4652@fx46.iad>
In reply to#90760
"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.
>
>Thats why I have name the person I'm talking to at the top of my message - 
>just like yours now.

No, you deleted the standard attribution lines.  Which when properly
done, allow easy determination of who wrote what.  That convention is
likely older than you are.

>
>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.

You would be wrong.

[toc] | [prev] | [next] | [standalone]


#90778

From"R.Wieser" <address@is.invalid>
Date2023-06-29 13:15 +0200
Message-ID<u7js2f$25ate$1@dont-email.me>
In reply to#90768
Scott,

>> 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.
>
> You would be wrong.

No, I don't think so.  It could really easily imagine that.

/s

Regards,
Rudy Wieser

[toc] | [prev] | [next] | [standalone]


#90744

Fromscott@slp53.sl.home (Scott Lurndal)
Date2023-06-26 14:03 +0000
Message-ID<YUgmM.111042$WpOe.41294@fx18.iad>
In reply to#90724
"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).

[toc] | [prev] | [next] | [standalone]


#90748

From"R.Wieser" <address@is.invalid>
Date2023-06-26 17:49 +0200
Message-ID<u7cd2f$108ec$2@dont-email.me>
In reply to#90744
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

[toc] | [prev] | [next] | [standalone]


#90757

FromKeith Thompson <Keith.S.Thompson+u@gmail.com>
Date2023-06-26 12:23 -0700
Message-ID<87jzvqyqm3.fsf@nosuchdomain.example.com>
In reply to#90744
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 */

[toc] | [prev] | [next] | [standalone]


#90775

Fromred floyd <no.spam.here@its.invalid>
Date2023-06-28 14:35 -0700
Message-ID<u7i92g$1scnm$1@redfloyd.dont-email.me>
In reply to#90724
On 6/25/2023 11:50 PM, R.Wieser wrote:


> The problem with that is that I need the keys at the moment they are pressed
> (and released ?), not only after "enter" is pressed.


Then you need to put the terminal into non-canonical mode (~ICANON).

See "man tcsetattr"


[toc] | [prev] | [next] | [standalone]


#90776

Fromgazelle@shell.xmission.com (Kenny McCormack)
Date2023-06-29 00:17 +0000
Message-ID<u7iiiq$1j6d8$1@news.xmission.com>
In reply to#90775
In article <u7i92g$1scnm$1@redfloyd.dont-email.me>,
red floyd  <no.spam.here@its.invalid> wrote:
>On 6/25/2023 11:50 PM, R.Wieser wrote:
>
>
>> The problem with that is that I need the keys at the moment they are pressed
>> (and released ?), not only after "enter" is pressed.
>
>
>Then you need to put the terminal into non-canonical mode (~ICANON).
>
>See "man tcsetattr"
>
>
>

Totally missing the point.

OP certainly knows all about setting the terminal modes (to RAW and/or ~ICANON).

The comment quoted above was in the context of the OP responding to a
suggestion by another user.  Other user had suggested using the GNU
"readline" library as a way of getting keystrokes.  OP noted that readline,
as its name implies, only returns when it has a full line - i.e., when the
user has pressed the "enter" key to send the line.

Hope that clears things up for you.

-- 
12% of Americans think that Joan of Arc was Noah's wife.

[toc] | [prev] | [next] | [standalone]


#90777

Fromscott@slp53.sl.home (Scott Lurndal)
Date2023-06-29 00:43 +0000
Message-ID<1t4nM.1647$fNr5.933@fx16.iad>
In reply to#90776
gazelle@shell.xmission.com (Kenny McCormack) writes:
>In article <u7i92g$1scnm$1@redfloyd.dont-email.me>,
>red floyd  <no.spam.here@its.invalid> wrote:
>>On 6/25/2023 11:50 PM, R.Wieser wrote:
>>
>>
>>> The problem with that is that I need the keys at the moment they are pressed
>>> (and released ?), not only after "enter" is pressed.
>>
>>
>>Then you need to put the terminal into non-canonical mode (~ICANON).
>>
>>See "man tcsetattr"
>>
>>
>>
>
>Totally missing the point.
>
>OP certainly knows all about setting the terminal modes (to RAW and/or ~ICANON).
>
>The comment quoted above was in the context of the OP responding to a
>suggestion by another user.  Other user had suggested using the GNU
>"readline" library as a way of getting keystrokes.  OP noted that readline,
>as its name implies, only returns when it has a full line - i.e., when the
>user has pressed the "enter" key to send the line.

However, readline and libedit internally handle vim and emacs line editing, for
which they must set the terminal to RAW mode, so the library sources
would be a useful resource for someone who wishes similar functionality.

[toc] | [prev] | [next] | [standalone]


#90780

From"R.Wieser" <address@is.invalid>
Date2023-06-29 14:04 +0200
Message-ID<u7js2g$25ate$3@dont-email.me>
In reply to#90777
Scott,

> However, readline and libedit internally handle vim and emacs line
> editing, for which they must set the terminal to RAW mode, so the
> library sources would be a useful resource for someone who wishes
> similar functionality.

But of little, if any, use to someone who started his initial post with 
"I've set the console input to raw so I can see keys coming in when they are 
pressed."

Indicating both already having done that /and/ getting a result he can work 
with.

Regards,
Rudy Wieser

[toc] | [prev] | [next] | [standalone]


#90783

Fromgazelle@shell.xmission.com (Kenny McCormack)
Date2023-06-29 15:44 +0000
Message-ID<u7k8sc$1k9jg$1@news.xmission.com>
In reply to#90780
In article <u7js2g$25ate$3@dont-email.me>, R.Wieser <address@is.invalid> wrote:
>Scott,
>
>> However, readline and libedit internally handle vim and emacs line
>> editing, for which they must set the terminal to RAW mode, so the
>> library sources would be a useful resource for someone who wishes
>> similar functionality.
>
>But of little, if any, use to someone who started his initial post with 
>"I've set the console input to raw so I can see keys coming in when they are 
>pressed."
>
>Indicating both already having done that /and/ getting a result he can work 
>with.

Indeed.  Well put.  There have been several responses on this thread that
have "totally missed the point" - assuming that your issue was "How do I
set the terminal to raw mode?" - when, obviously, you'd already done that.

Maybe a language barrier problem.  English not being their first language.

Aside: Some have suggested, as above, that you read/study the readline
source code for inspiration.  I doubt that will help, as that code is
pretty opaque.

What this all boils down to is that there really should be an off-the-shelf
solution to this all-too-common problem.  There apparently isn't.  It should
be possible for someone to rip that functionality out of (n)curses, so that
you could use it, without the full-on commitment to (n)curses.

-- 
No puppet.
No puppet.
You're a puppet.

[toc] | [prev] | [next] | [standalone]


#90785

From"R.Wieser" <address@is.invalid>
Date2023-06-29 18:37 +0200
Message-ID<u7kc0s$26v5q$1@dont-email.me>
In reply to#90783
Kenny,

> Maybe a language barrier problem.  English not being their first
> language.

There is also a good possibility that, as you mentioned yourself, the 
responder just read a single post and took their (absense of a) clue from 
there.  Not bothering to even check out the threads starting post.

> What this all boils down to is that there really should be an off-
> the-shelf solution to this all-too-common problem.

:-)  and that was/is pretty-much exactly what I was thinking, and tried to 
find out, thru this newsgroup, if it exists.

Color me surprised that I now have to conclude a programmer has to write, 
for *every program* which does not use a line-based input method, such a 
parser himself.

> It should be possible for someone to rip that functionality out of
> (n)curses, so that you could use it, without the full-on commitment
> to (n)curses.

Depends on how it needs to be used.   Currently I've got some code which 
times out if nothing comes in or something incomplete has been parsed (it 
doesn't block).

And by the way: I have quite a problem with the ^Z (26) being send as the 
start of a command sequence as well on its own when the ESC key is pressed 
(IOW, no escaping of the ESC key).  I do not see any way to, in a stream, 
detect if its one or the other.  Its just asking for trouble. :-(

Regards,
Rudy Wieser

[toc] | [prev] | [next] | [standalone]


#90790

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2023-06-30 14:14 +0100
Message-ID<8735293xdb.fsf@bsb.me.uk>
In reply to#90785
"R.Wieser" <address@is.invalid> writes:

>> What this all boils down to is that there really should be an off-
>> the-shelf solution to this all-too-common problem.
>
> :-)  and that was/is pretty-much exactly what I was thinking, and tried to 
> find out, thru this newsgroup, if it exists.

As far as I can tell there /is/ a solution, but this, being a C++ group,
is not the best one for the question so maybe no one has given the
details.

> Color me surprised that I now have to conclude a programmer has to write, 
> for *every program* which does not use a line-based input method, such a 
> parser himself.
>
>> It should be possible for someone to rip that functionality out of
>> (n)curses, so that you could use it, without the full-on commitment
>> to (n)curses.

I think the solution is right there in ncurses.

> Depends on how it needs to be used.   Currently I've got some code which 
> times out if nothing comes in or something incomplete has been parsed (it 
> doesn't block).

ncurses provides a function to do this parsing with and without a
timeout.  If that is not, in fact, what you want then you should explain
why ncurses's "keypad" setting does not do what you want.

-- 
Ben.

[toc] | [prev] | [next] | [standalone]


#90793

From"R.Wieser" <address@is.invalid>
Date2023-06-30 18:12 +0200
Message-ID<u7muuc$2j6av$2@dont-email.me>
In reply to#90790
Ben,

> As far as I can tell there /is/ a solution, but this, being a C++
> group, is not the best one for the question so maybe no one has
> given the details.

I assumed that a good percentage of users here would be using Linux, and the 
question would make sense to them.   I must have assumed wrong.

> ncurses provides a function to do this parsing with and without
> a timeout.  If that is not, in fact, what you want then you should
> explain why ncurses's "keypad" setting does not do what you want.

I would need to install it (its not part of the OS installation) and I've 
heard that its a bit "demanding" :

[quote=Alf P. Steinbach, Sun, 25 Jun 2023 15:06:29 -0700]
curses takes over the entire (text / terminal) screen, keeping track of what 
character is shown at each location and using minimal output to update it as 
needed.
[/quote]

Which is /absolutily not/ what I'm currently looking for.  Thats like using 
a cannon to kill a mosquito.

Regards,
Rudy Wieser

[toc] | [prev] | [next] | [standalone]


#90797

From"R.Wieser" <address@is.invalid>
Date2023-06-30 20:32 +0200
Message-ID<u7n78s$2k1te$2@dont-email.me>
In reply to#90793
Scott,

> Not everything you "hear" is accurate.

I hope you are aware that the same thing goes for what I "hear" from you 
too.

[snip long list of (mostly) functions]

I don't see anything there contradicting Alfs statement.

And as you did not bother to point anything out that does ...  You lose.

Regards,
Rudy Wieser

[toc] | [prev] | [next] | [standalone]


Page 2 of 8 — ← Prev page 1 [2] 3 4 5 6 7 8  Next page →

Back to top | Article view | comp.lang.c++


csiph-web