diff options
author | Amadeusz Sławiński <amade@asmblr.net> | 2019-09-07 17:58:50 +0200 |
---|---|---|
committer | Amadeusz Sławiński <amade@asmblr.net> | 2019-09-07 18:38:55 +0200 |
commit | fad4c29fd95d30639a67142066f623396fca8536 (patch) | |
tree | 4b0e6c58b353a82389d90345bbd2e22017646088 | |
parent | d6e9a6a6936e6e9ccc6079edda2368f90ad933dd (diff) | |
download | screen-fad4c29fd95d30639a67142066f623396fca8536.tar.gz |
Fix broken mouse after ncurses 6.1
ncurses 6.1 changed kmous capability from "\e[M" to "\e[<". It seems to
be done to signal that terminal supports sgr mouse mode. screen assumed
that if kmous is set to "\e[M" it is on xterm compatible terminal
anyway, so just dynamically detect which one is used and override
relevant kmapdef.
InitKeytab() is moved, so kmapdef[] can be overriden before
initialization, as InitTermcap() needs to run first, as far as I can
tell this should have no consequences.
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
-rw-r--r-- | src/screen.c | 2 | ||||
-rw-r--r-- | src/termcap.c | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/screen.c b/src/screen.c index 65fc88d..c50952b 100644 --- a/src/screen.c +++ b/src/screen.c @@ -1351,7 +1351,6 @@ int main(int ac, char** av) * new ones. */ ServerSocket = MakeServerSocket(true); - InitKeytab(); #ifdef ETCSCREENRC # ifdef ALLOW_SYSSCREENRC @@ -1389,6 +1388,7 @@ int main(int ac, char** av) InitLoadav(); #endif /* LOADAV */ + InitKeytab(); MakeNewEnv(); signal(SIGHUP, SigHup); signal(SIGINT, FinitHandler); diff --git a/src/termcap.c b/src/termcap.c index 1190960..1d4724d 100644 --- a/src/termcap.c +++ b/src/termcap.c @@ -38,6 +38,7 @@ extern struct NewWindow nwin_undef, nwin_default, nwin_options; extern int force_vt; extern int hardstatusemu; #ifdef MAPKEYS +extern char *kmapdef[]; extern struct action umtab[]; extern struct action mmtab[]; extern struct action dmtab[]; @@ -47,7 +48,6 @@ extern int kmap_extn; extern int DefaultEsc; #endif - static void AddCap __P((char *)); static void MakeString __P((char *, char *, int, char *)); static char *findcap __P((char *, char **, int)); @@ -224,8 +224,11 @@ int he; if ((D_EA && InStr(D_EA, "\033(B")) || (D_AS && InStr(D_AS, "\033(0"))) D_CG0 = 1; if (InStr(D_termname, "xterm") || InStr(D_termname, "rxvt") || - (D_CKM && InStr(D_CKM, "\033[M"))) - D_CXT = 1; + (D_CKM && (InStr(D_CKM, "\033[M") || InStr(D_CKM, "\033[<")))) + { + D_CXT = 1; + kmapdef[0] = SaveStr(D_CKM); + } /* "be" seems to be standard for xterms... */ if (D_CXT) D_BE = 1; |