]> granicus.if.org Git - vim/commitdiff
patch 8.2.0773: switching to raw mode every time ":" is used v8.2.0773
authorBram Moolenaar <Bram@vim.org>
Sat, 16 May 2020 21:15:08 +0000 (23:15 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 16 May 2020 21:15:08 +0000 (23:15 +0200)
Problem:    Switching to raw mode every time ":" is used.
Solution:   When executing a shell set cur_tmode to TMODE_UNKNOWN, so that the
            next time TMODE_RAW is used it is set, but not every time.

src/os_amiga.c
src/os_unix.c
src/os_win32.c
src/term.c
src/term.h
src/version.c

index 1e3fd4b2017da7f2833b0160ff21d8aad0007612..58e462d5cbeaa2e4e2128c34d6a7948faa82e560 100644 (file)
@@ -1387,7 +1387,11 @@ mch_call_shell(
     if ((mydir = CurrentDir(mydir)) != 0) // make sure we stay in the same directory
        UnLock(mydir);
     if (tmode == TMODE_RAW)
+    {
+       // The shell may have messed with the mode, always set it.
+       cur_tmode = TMODE_UNKNOWN;
        settmode(TMODE_RAW);            // set to raw mode
+    }
 #ifdef FEAT_TITLE
     resettitle();
 #endif
index aea3d5a9e2df38780d07cd732d14393f793de7e3..9162f5bf8a0810eb2bcb6cfd610625dc8ad694ad 100644 (file)
@@ -4521,7 +4521,11 @@ mch_call_shell_system(
     }
 
     if (tmode == TMODE_RAW)
+    {
+       // The shell may have messed with the mode, always set it.
+       cur_tmode = TMODE_UNKNOWN;
        settmode(TMODE_RAW);    // set to raw mode
+    }
 # ifdef FEAT_TITLE
     resettitle();
 # endif
@@ -4571,6 +4575,9 @@ mch_call_shell_fork(
     out_flush();
     if (options & SHELL_COOKED)
        settmode(TMODE_COOK);           // set to normal mode
+    if (tmode == TMODE_RAW)
+       // The shell may have messed with the mode, always set it later.
+       cur_tmode = TMODE_UNKNOWN;
 
     if (unix_build_argv(cmd, &argv, &tofree1, &tofree2) == FAIL)
        goto error;
index 52bc95de8853f82ba5cebaf51fbfa0d3d35f7c74..d77e2169168bd2ff3faab09a7d697edaa36ab3a6 100644 (file)
@@ -4899,7 +4899,11 @@ mch_call_shell(
     }
 
     if (tmode == TMODE_RAW)
+    {
+       // The shell may have messed with the mode, always set it.
+       cur_tmode = TMODE_UNKNOWN;
        settmode(TMODE_RAW);    // set to raw mode
+    }
 
     // Print the return value, unless "vimrun" was used.
     if (x != 0 && !(options & SHELL_SILENT) && !emsg_silent
index 9803a1bb9469f9ef87451524503e49a1a8d720fe..1260c9a37da9aad62d2206e26f793ac9438701c0 100644 (file)
@@ -2862,7 +2862,7 @@ term_color(char_u *s, int n)
 #if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS)
                  || (s[0] == ESC && s[1] == '|')
 #endif
-                 || (s[0] == CSI && (i = 1) == 1))
+                 || (s[0] == CSI && (i = 1) == 1))
              && s[i] != NUL
              && (STRCMP(s + i + 1, "%p1%dm") == 0
                  || STRCMP(s + i + 1, "%dm") == 0)
@@ -3447,14 +3447,14 @@ settmode(int tmode)
     if (full_screen)
     {
        /*
-        * When returning after calling a shell we want to really set the
-        * terminal to raw mode, even though we think it already is, because
-        * the shell program may have reset the terminal mode.
+        * When returning after calling a shell cur_tmode is TMODE_UNKNOWN,
+        * set the terminal to raw mode, even though we think it already is,
+        * because the shell program may have reset the terminal mode.
         * When we think the terminal is normal, don't try to set it to
         * normal again, because that causes problems (logout!) on some
         * machines.
         */
-       if (tmode != TMODE_COOK || cur_tmode != TMODE_COOK)
+       if (tmode != cur_tmode)
        {
 #ifdef FEAT_TERMRESPONSE
 # ifdef FEAT_GUI
index f1c3df5344dd594fa42d775590414e226315ad64..b9535ee1de2610087751cb243e8ac9c5f6fffced 100644 (file)
@@ -209,6 +209,7 @@ extern char_u *(term_strings[]);    // current terminal strings
 #define T_SSI  (TERM_STR(KS_SSI))      // save icon text
 #define T_SRI  (TERM_STR(KS_SRI))      // restore icon text
 
-#define TMODE_COOK  0  // terminal mode for external cmds and Ex mode
-#define TMODE_SLEEP 1  // terminal mode for sleeping (cooked but no echo)
-#define TMODE_RAW   2  // terminal mode for Normal and Insert mode
+#define TMODE_COOK     0   // terminal mode for external cmds and Ex mode
+#define TMODE_SLEEP    1   // terminal mode for sleeping (cooked but no echo)
+#define TMODE_RAW      2   // terminal mode for Normal and Insert mode
+#define TMODE_UNKNOWN   9   // after executing a shell
index fa8ba91ce47de6488bf5a72fae3bf2e32ecf4e63..6a28ae35f89a4ea40e359f883914e18b0619c8fd 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    773,
 /**/
     772,
 /**/