]> Sergey Matveev's repositories - nnn.git/commitdiff
fix: no mouse support inside vim terminal
authorNRK <nrk@disroot.org>
Thu, 21 Oct 2021 11:28:13 +0000 (17:28 +0600)
committerNRK <nrk@disroot.org>
Thu, 21 Oct 2021 12:21:59 +0000 (18:21 +0600)
we need to signal mouse event by printing these escape codes. the X10
escape code seems to be legacy format only used as fallback incase SGR
extended coordinates aren't supported.

src/nnn.c

index 8499489aa8691e34fb7e5be9eb759d110df2646e..1267a80ae65a8cf818f86fa05bc415cda3bc61dd 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -2079,6 +2079,10 @@ static bool initcurses(void *oldmask)
        //intrflush(stdscr, FALSE);
        keypad(stdscr, TRUE);
 #ifndef NOMOUSE
+#ifndef NOX11
+       printf("\x1b[?1000h\n"); /* xterm X10 mouse mode */
+       printf("\x1b[?1006h\n"); /* extended SGR mouse mode */
+#endif
 #if NCURSES_MOUSE_VERSION <= 1
        mousemask(BUTTON1_PRESSED | BUTTON1_DOUBLE_CLICKED | BUTTON2_PRESSED | BUTTON3_PRESSED,
                  (mmask_t *)oldmask);