bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fw: Re: keypad & non-default terminal


From: folkert
Subject: Fw: Re: keypad & non-default terminal
Date: Thu, 4 May 2017 10:30:42 +0200
User-agent: NeoMutt/20170306 (1.8.0)

Hi Rob,

Well let's ignore the local echo part, that's probably something to do
with me not sending the correct telnet commands (255, ...etc)

The biggest problem is that ncurses does not parse/process the key
presses correctly. It receives e.g. an ansi byte sequence for page up
but passes that on directly to the program instead of parsing them and
converting them to KEY_NPAGE etc.

On Wed, May 03, 2017 at 03:29:59PM -0500, Rob King wrote:
> Hi,
> 
>     Calling nodelay, etc. cannot set the other end of the connection's
> buffering. Are you in control of the code on the client side? You'll need to
> set it to be unbuffered when waiting for input on the client side before
> establishing the connection to the server.
> 
>     Depending on what you're trying to do, you might also want to set
> TCP_NODELAY using setsockopt(2) on the client side, though that might be
> overkill.
> 
>     Thanks!
> 
> 
> (Please note that I am not affiliated with the ncurses project; just trying
> to help.)
> 
> 
> 
> On 05/03/2017 02:43 PM, folkert wrote:
> > Hi,
> > 
> > I have a program which accepts network connections and then maps an
> > ncurses session on them:
> > 
> > void loop()
> > {
> >     int fd = accept(...)
> > 
> >          FILE *fh = fdopen(fd, "rw");
> > 
> >          SCREEN *scr = newterm("ansi", fh, fh);
> >     set_term(scr);
> > 
> >          WINDOW *win = newwin(25, 80, 0, 0);
> > 
> >          start_color();
> >          cbreak();
> >          keypad(win, TRUE);
> >          intrflush(win, FALSE);
> >          nodelay(win, FALSE);
> >          meta(win, TRUE);
> >          idlok(win, TRUE);
> >          idcok(win, TRUE);
> >          leaveok(win, FALSE);
> > 
> >     for(;;)
> >             printf("[%d]", wgetch(win));
> > }
> > 
> > Now I would expect to get values like 0522 for page down and 0523 for
> > page down but instead:
> > - it waits for enter on the screen in which the program is started, NOT
> >    the network connection
> > - the key pressed is printed as garbage on the network connection: ^[[5~
> > - the key is returned as a bunch of characters instead
> >    ([27][91][53][126])
> > 
> > So it looks like that cbreak and keypad are ignored while wgetch not
> > only listens on the fd given by newterm but also the regular stdin one.
> > 
> > Hopefully I'm doing something wrong.
> > 
> > 
> > regards
> > 
> > _______________________________________________
> > Bug-ncurses mailing list
> > address@hidden
> > https://lists.gnu.org/mailman/listinfo/bug-ncurses



reply via email to

[Prev in Thread] Current Thread [Next in Thread]