Path: csiph.com!news.mixmin.net!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: 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: <871qhy1usn.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/Suxs8Qcp3PyrLMdVej3gZ" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cancel-Lock: sha1:f7yuCAQOS35yjjPNCqQUryNxAEc= sha1:9r46qObaMvD4qIG+K8JevCY9jaw= Xref: csiph.com comp.lang.c++:90754 "R.Wieser" writes: > Keith, Your newsreader should add attribution lines, like the "R.Wieser" 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 */