bug-ncurses
[Top][All Lists]
Advanced

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

SGR mouse only if term_names =~ xterm?


From: Tomas Janousek
Subject: SGR mouse only if term_names =~ xterm?
Date: Mon, 19 Nov 2018 19:27:44 +0100
User-agent: NeoMutt/20180716

Hi Thomas and others,

I patched my local rxvt-unicode with SGR (1006) mouse support but I had
trouble getting it to work in ncurses even though I set correct kmous, xm and
XM in terminfo. Turns out there's this code in ncurses/base/lib_mouse.c:

    /* we know how to recognize mouse events under "xterm" */
    if (key_mouse != 0) {
        if (!strcmp(key_mouse, xterm_kmous)
            || strstr(SP_TERMTYPE term_names, "xterm") != 0) {
            init_xterm_mouse(sp);
        }
    } else if (strstr(SP_TERMTYPE term_names, "xterm") != 0) {
        if (_nc_add_to_try(&(sp->_keytry), xterm_kmous, KEY_MOUSE) == OK)
            init_xterm_mouse(sp);
    }

which essentially means:

    either kmous = \E[M or term_names =~ /xterm/
    otherwise no mouse support

So to get it working, I had to mention "xterm" in the terminfo entry:

    rxvt-unicode-256color|rxvt-unicode terminal with 256 colors (X Window 
System) + xterm+sm+1006,

(And then I had to do the same for tmux-256color. If anyone's interested, I
ended up with 
https://github.com/liskin/dotfiles/blob/fec60081b77b254bd0aaf1f471335fa6bb5dc206/.terminfo/terminfo.src)

Is that intentional? There are multiple terminfo entries in misc/terminfo.src
that use=xterm+sm+1006 but don't include "xterm" in their name (like vte-2014,
nsterm-build400, teraterm4.97) and I suspect mouse won't work in these either.
Indeed, using TERM=vte in gnome-terminal, mouse is non-functional in ncurses
apps. It does work with with TERM=vte-256color, though, because the longname
of that is "VTE with xterm 256-colors".

-- 
Tomáš Janoušek, a.k.a. Pivník, a.k.a. Liskni_si, http://work.lisk.in/



reply via email to

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