Path: csiph.com!news.mixmin.net!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: comp.lang.c++ Subject: Re: Parsing multi-byte keystrokes Date: Fri, 30 Jun 2023 14:14:55 +0100 Organization: A noiseless patient Spider Lines: 32 Message-ID: <8735293xdb.fsf@bsb.me.uk> References: <1t4nM.1647$fNr5.933@fx16.iad> MIME-Version: 1.0 Content-Type: text/plain Injection-Info: dont-email.me; posting-host="a4b05ae8aedf0607a60b70f6ae5acfc5"; logging-data="2687567"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+AjJLxXXNdxchiHLrqfJtkyDDaGb9/f9Y=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) Cancel-Lock: sha1:qdmfZt86UUL/lUmM0PDdDD+J4LQ= sha1:F8WAn4pvE63/C1j/ckU/tx/peA8= X-BSB-Auth: 1.ae9f5943b12897cf64e2.20230630141456BST.8735293xdb.fsf@bsb.me.uk Xref: csiph.com comp.lang.c++:90790 "R.Wieser" 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.