dankamongmen / notcurses

blingful character graphics/TUI library. definitely not curses.
https://nick-black.com/dankwiki/index.php/Notcurses
Other
3.43k stars 113 forks source link

On alacritty ncinput_alt_p never returns true #2735

Open endofunky opened 9 months ago

endofunky commented 9 months ago

I've noticed that on alacritty the ncinput_alt_p and ncinput_meta_p functions never return 1 when the alt key is pressed. The ncinput.alt value, however, is set correctly and indicates that alt was pressed.

In other terminal emulators that I've tried this is working correctly.

I'm not sure if I'm missing something here, but if not, is there a known workaround that doesn't require using deprecated APIs? I'm using the rust wrapper library and it doesn't expose the underlying ncinput struct from what I can tell.

Small example to reproduce:

#include <notcurses/notcurses.h>

int main(void)
{
    ncinput ni;

    struct notcurses* nc = notcurses_core_init(NULL, NULL);
    struct ncplane* plane = notcurses_stdplane(nc);

    while (notcurses_get_blocking(nc, &ni) != -1) {
        if (ni.evtype == NCTYPE_RELEASE)
            continue;

        ncplane_printf_yx(plane, 0, 0, "alt_p: %d", ncinput_alt_p(&ni));
        ncplane_printf_yx(plane, 1, 0, "meta_p: %d", ncinput_meta_p(&ni));
        ncplane_printf_yx(plane, 2, 0, "ncinput.alt: %d", ni.alt);
        notcurses_render(nc);
    }

    notcurses_stop(nc);

    return 0;
}

Additional info

notcurses 3.0.9 alacritty 0.12.3

$ export | egrep 'LANG|LC_CTYPE|TERM
LANG=en_GB.UTF-8
LANGUAGE=en_GB.UTF-8
TERM=alacritty-direct
TERMINFO_DIRS=/home/ef/.nix-profile/share/terminfo:/home/ef/.local/state/nix/profile/share/terminfo:/etc/profiles/per-user/ef/share/terminfo:/nix/var/nix/profiles/default/share/terminfo:/run/current-system/sw/share/terminfo
dankamongmen commented 9 months ago

great bug report, thanks a lot! i can't spend much time on notcurses these days, but i might be doing so soon, and i'll definitely want to get to this.