To: vim_dev@googlegroups.com Subject: Patch 8.2.0773 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0773 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. Files: src/term.h, src/os_unix.c, src/term.c, src/os_amiga.c, src/os_win32.c *** ../vim-8.2.0772/src/term.h 2019-11-30 18:57:01.000000000 +0100 --- src/term.h 2020-05-16 22:57:57.701016251 +0200 *************** *** 209,214 **** #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 --- 209,215 ---- #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_UNKNOWN 9 // after executing a shell *** ../vim-8.2.0772/src/os_unix.c 2020-05-11 22:13:24.793171617 +0200 --- src/os_unix.c 2020-05-16 23:02:51.012264513 +0200 *************** *** 4521,4527 **** --- 4524,4534 ---- } 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,4576 **** --- 4578,4586 ---- 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; *** ../vim-8.2.0772/src/term.c 2020-05-16 15:04:58.015319463 +0200 --- src/term.c 2020-05-16 23:00:03.148699859 +0200 *************** *** 2862,2868 **** #if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS) || (s[0] == ESC && s[1] == '|') #endif ! || (s[0] == CSI && (i = 1) == 1)) && s[i] != NUL && (STRCMP(s + i + 1, "%p1%dm") == 0 || STRCMP(s + i + 1, "%dm") == 0) --- 2862,2868 ---- #if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS) || (s[0] == ESC && s[1] == '|') #endif ! || (s[0] == CSI && (i = 1) == 1)) && s[i] != NUL && (STRCMP(s + i + 1, "%p1%dm") == 0 || STRCMP(s + i + 1, "%dm") == 0) *************** *** 3447,3460 **** 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 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) { #ifdef FEAT_TERMRESPONSE # ifdef FEAT_GUI --- 3447,3460 ---- if (full_screen) { /* ! * 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 != cur_tmode) { #ifdef FEAT_TERMRESPONSE # ifdef FEAT_GUI *** ../vim-8.2.0772/src/os_amiga.c 2020-01-17 19:32:14.743572013 +0100 --- src/os_amiga.c 2020-05-16 23:01:22.000496888 +0200 *************** *** 1387,1393 **** --- 1387,1397 ---- 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 *** ../vim-8.2.0772/src/os_win32.c 2020-04-30 20:59:54.080610231 +0200 --- src/os_win32.c 2020-05-16 23:03:17.420194997 +0200 *************** *** 4899,4905 **** --- 4899,4909 ---- } 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 *** ../vim-8.2.0772/src/version.c 2020-05-16 22:33:29.000787967 +0200 --- src/version.c 2020-05-16 23:13:19.050565034 +0200 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 773, /**/ -- Corduroy pillows: They're making headlines! /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///