]> granicus.if.org Git - vim/commitdiff
patch 8.1.2121: mode is not updated when switching to terminal v8.1.2121
authorBram Moolenaar <Bram@vim.org>
Mon, 7 Oct 2019 20:27:36 +0000 (22:27 +0200)
committerBram Moolenaar <Bram@vim.org>
Mon, 7 Oct 2019 20:27:36 +0000 (22:27 +0200)
Problem:    Mode is not updated when switching to terminal in Insert mode.
Solution:   Redraw the mode when entering a terminal window. (Jason Franklin)

src/testdir/test_window_cmd.vim
src/version.c
src/window.c

index ffe8f431d463e15ffeec115818e132165579eb02..d958c36973c2fcbe0f1d0cb8a7a175b67f0c2318 100644 (file)
@@ -1,5 +1,7 @@
 " Tests for window cmd (:wincmd, :split, :vsplit, :resize and etc...)
 
+so check.vim
+
 func Test_window_cmd_ls0_with_split()
   set ls=0
   set splitbelow
@@ -557,6 +559,33 @@ func Test_access_freed_mem()
   call assert_equal(&columns, winwidth(0))
 endfunc
 
+func Test_insert_cleared_on_switch_to_term()
+  CheckFeature terminal
+
+  set showmode
+  terminal
+  wincmd p
+
+  call feedkeys("i\<C-O>", 'ntx')
+  redraw
+
+  " The "-- (insert) --" indicator should be visible.
+  let chars = map(range(1, &columns), 'nr2char(screenchar(&lines, v:val))')
+  let str = trim(join(chars, ''))
+  call assert_equal('-- (insert) --', str)
+
+  call feedkeys("\<C-W>p", 'ntx')
+  redraw
+
+  " The "-- (insert) --" indicator should have been cleared.
+  let chars = map(range(1, &columns), 'nr2char(screenchar(&lines, v:val))')
+  let str = trim(join(chars, ''))
+  call assert_equal('', str)
+
+  set showmode&
+  %bw!
+endfunc
+
 func Test_visual_cleared_after_window_split()
   new | only!
   let smd_save = &showmode
index f668b9704e36388f036db26e2d2e1704298e4db4..f4d027534435b331cbb9cee269ea5823a0ac7183 100644 (file)
@@ -753,6 +753,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2121,
 /**/
     2120,
 /**/
index 6416e0187cee0cc6b386813703d59e60419403f5..6174c02fd376d49cd4b467ac896dc46d52d090cd 100644 (file)
@@ -4654,6 +4654,9 @@ win_enter_ext(
     maketitle();
 #endif
     curwin->w_redr_status = TRUE;
+    if (bt_terminal(wp->w_buffer))
+       // terminal is likely in another mode
+       redraw_mode = TRUE;
     redraw_tabline = TRUE;
     if (restart_edit)
        redraw_later(VALID);    /* causes status line redraw */