[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
keypad & non-default terminal
From: |
folkert |
Subject: |
keypad & non-default terminal |
Date: |
Wed, 3 May 2017 21:43:37 +0200 |
User-agent: |
NeoMutt/20170306 (1.8.0) |
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
- keypad & non-default terminal,
folkert <=