[Top][All Lists]

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

Re: Two issues with using ncurses with "gdb -tui" on Windows

From: Eli Zaretskii
Subject: Re: Two issues with using ncurses with "gdb -tui" on Windows
Date: Sun, 04 Jan 2015 18:05:04 +0200

> Date: Fri, 2 Jan 2015 13:08:15 -0500
> From: Thomas Dickey <address@hidden>
> Cc: address@hidden
> > > Normally (unless some application does something), those keys do not send
> > > characters.  I've thought about providing dummy strings (e.g., to match 
> > > some
> > > existing terminal), but arguably it's correct as is, and without knowing 
> > > how an
> > > application might use the strings, I don't see a need to change ncurses.
> > 
> > Sorry, I'm not sure I'm following.  What does ncurses do now on
> > Windows, when the application calls 'keypad' to disable the keypad?
> > Does the behavior of getch and wgetch changes in any way after such a
> > call on Windows, when the arrow keys are pressed?  Or does ncurses
> > send nothing when these keys are pressed?
> There might be something (I'm not where I can test) - but reading the code,
>       + The timed-wait function discards keydown events if keypad mode's off.
>       + The console-read function discards keydown events if keypad mode is
>         off and there was no character associated with the event.

I think you are right, as this excerpt from win_driver.c:drv_read

    while ((b = ReadConsoleInput(TCB->inp, &inp_rec, 1, &nRead))) {
        if (b && nRead > 0) {
            if (inp_rec.EventType == KEY_EVENT) {
                if (!inp_rec.Event.KeyEvent.bKeyDown)
                *buf = (int) inp_rec.Event.KeyEvent.uChar.AsciiChar;
                vk = inp_rec.Event.KeyEvent.wVirtualKeyCode;
                sc = inp_rec.Event.KeyEvent.wVirtualScanCode;
                if (*buf == 0) {
                    if (sp->_keypad_on) {
                        *buf = MapKey(TCB, vk);
                        if (0 > (*buf))
                    } else

My interpretation of this is that only ASCII keypresses are returned
to the caller when the keypad mode is off.  All the other keypresses
are simply discarded.

Would it make sense to emulate what MS _getch returns in that case,
i.e. sequences that start with \340?

reply via email to

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