bug-ncurses
[Top][All Lists]
Advanced

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

Re: Ncurses keypad is not properly working in FreeBSD


From: Archimedes Gaviola
Subject: Re: Ncurses keypad is not properly working in FreeBSD
Date: Thu, 26 Jan 2023 16:35:29 +0800



On Wed, Jan 25, 2023 at 1:02 PM Archimedes Gaviola <archimedes.gaviola@gmail.com> wrote:


On Tue, Jan 24, 2023 at 4:59 PM Thomas Dickey <dickey@his.com> wrote:
On Tue, Jan 24, 2023 at 12:09:08PM +0800, Archimedes Gaviola wrote:
>  Hi,
>
> I have a C program that accepts and displays numeric characters in 0-9 only
> and with alphabet keys, function keys are expected not to respond to any
> code from the keyboard using keypad(). I simulated a plain Ncurses C
> program without a window and another one with a window using the newwin()
> function. The program without window works getting no response from
> alphabet keys as well as function keys, however the Enter/return key (ch ==
> KEY_ENTER) is not working instead I use (ch == '\n') to get it to work. The


Hi Thomas,
 
The usual point of confusion for KEY_ENTER is that terminal descriptions
use the escape sequence from the numeric-keypad (active when keypad() is
called), rather than the "Enter" key on the main keyboard.

The numeric keypad in xterm (like vt100, etc), sends escape sequences
when keypad-mode is enabled.  xterm changes those to the "face codes",
e.g., 0, 1, 2, etc., when NumLock is pressed.  Those escape sequences
are documented in the xterm control sequences.

Okay let me check that document.
 

Some other terminals (for which of course no documentation exists)
use different escape sequences (determined by the X keyboard configuration),
e.g., cursor-keys, page up/down, etc.



Hi Thomas,

Okay I found this document https://www.xfree86.org/current/ctlseqs.html (Xterm Control Sequences) and basically in the PC-Style Function Keys section here https://www.xfree86.org/current/ctlseqs.html#PC-Style%20Function%20Keys the keycodes that appear in my program (with window) are exactly the same as described, so below mappings are experienced when each corresponding key is pressed.

F5 - 15
F6 - 17
F7 - 18
F8 - 19
F9 - 20
F10 - 21
F11 - 23
F12 - 24

Insert - 2
Delete - 3
Page Up - 5
Page Down - 6

Do you think this is just a matter of tweaks somewhere in the code or terminal console configuration? Any hint?

Thanks and best regards,
Archimedes 







reply via email to

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