From 1b3cbb39a15aa006ad3504966851352b4a5a71f2 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 15 Jul 2018 09:45:38 -0400 Subject: vim-patch:8.0.1705: when making a vertical split the mode message isn't updated Problem: When making a vertical split the mode message isn't always updated, "VISUAL" remains. (Alexei Averchenko) Solution: Only reset clear_cmdline when filling all columns of the last screen line. (Tom M. closes vim/vim#2611) https://github.com/vim/vim/commit/5bab555c2f1b3b86d57e4adeb86d908eff477fc9 --- src/nvim/screen.c | 3 ++- src/nvim/testdir/test_window_cmd.vim | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/nvim/screen.c b/src/nvim/screen.c index d4cbe36bd5..f7fdc6060d 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -5816,7 +5816,8 @@ void screen_fill(int start_row, int end_row, int start_col, int end_col, int c1, // TODO(bfredl): The relevant caller should do this if (row == Rows - 1) { // overwritten the command line redraw_cmdline = true; - if (c1 == ' ' && c2 == ' ') { + if (start_col == 0 && end_col == Columns + && c1 == ' ' && c2 == ' ' && attr == 0) { clear_cmdline = false; // command line has been cleared } if (start_col == 0) { diff --git a/src/nvim/testdir/test_window_cmd.vim b/src/nvim/testdir/test_window_cmd.vim index 842a6db8a2..3ee96e36ca 100644 --- a/src/nvim/testdir/test_window_cmd.vim +++ b/src/nvim/testdir/test_window_cmd.vim @@ -466,4 +466,28 @@ func Test_access_freed_mem() bwipe xxx endfunc +func Test_visual_cleared_after_window_split() + new | only! + let smd_save = &showmode + set showmode + let ls_save = &laststatus + set laststatus=1 + call setline(1, ['a', 'b', 'c', 'd', '']) + norm! G + exe "norm! kkvk" + redraw + exe "norm! \v" + redraw + " check if '-- VISUAL --' disappeared from command line + let columns = range(1, &columns) + let cmdlinechars = map(columns, 'nr2char(screenchar(&lines, v:val))') + let cmdline = join(cmdlinechars, '') + let cmdline_ltrim = substitute(cmdline, '^\s*', "", "") + let mode_shown = substitute(cmdline_ltrim, '\s*$', "", "") + call assert_equal('', mode_shown) + let &showmode = smd_save + let &laststatus = ls_save + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit