]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0855: 'showcmd' not redrawn with empty mapping triggered on timeout v9.2.0855
authorzeertzjq <zeertzjq@outlook.com>
Sat, 25 Jul 2026 16:46:29 +0000 (16:46 +0000)
committerChristian Brabandt <cb@256bit.org>
Sat, 25 Jul 2026 16:46:29 +0000 (16:46 +0000)
Problem:  'showcmd' not redrawn with empty mapping triggered on timeout.
Solution: Don't postpone redraw when inside vgetorpeek(). Also move test
          for tabline 'showcmd' to test_tabline.vim.

fixes:  #20839
closes: #20840

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/normal.c
src/testdir/test_statusline.vim
src/testdir/test_tabline.vim
src/version.c

index d5de6abe5115f4046fdee469070d5c4fb7591890..a7959d62f1e555e82e46327a2a9ccebe82e1d948 100644 (file)
@@ -1850,14 +1850,14 @@ display_showcmd(void)
 
     if (*p_sloc == 's')
     {
-       if (showcmd_is_clear)
+       if (showcmd_is_clear && !vgetc_busy)
            curwin->w_redr_status = true;
        else
            win_redr_status(curwin, FALSE);
     }
     else if (*p_sloc == 't')
     {
-       if (showcmd_is_clear)
+       if (showcmd_is_clear && !vgetc_busy)
            redraw_tabline = TRUE;
        else
            draw_tabline();
index 69699a2d4dfcb813cad69241ef5d436f952d9276..6df015be1d4f0a4c368b72eda218bedf66259f3d 100644 (file)
@@ -657,23 +657,6 @@ func Test_statusline_showcmd()
   call StopVimInTerminal(buf)
 endfunc
 
-func Test_statusline_showcmd_redraw_tabline()
-  CheckRunVimInTerminal
-
-  let lines =<< trim END
-    set showcmd showcmdloc=tabline showtabline=2 tabline=%S timeoutlen=0
-    nnoremap g :redraw<CR>
-    nnoremap gc <Nop>
-  END
-  call writefile(lines, 'XTest_statusline_showcmd_redraw', 'D')
-
-  let buf = RunVimInTerminal('-S XTest_statusline_showcmd_redraw', #{rows: 6, cols: 40})
-  call term_sendkeys(buf, 'g')
-  call WaitForAssert({-> assert_match(':redraw', term_getline(buf, 6))})
-  call WaitForAssert({-> assert_notmatch('^:', term_getline(buf, 1))})
-  call StopVimInTerminal(buf)
-endfunc
-
 func Test_statusline_showcmd_cmd_mapping()
   set showcmd
   set statusline=AAA%SBBB
@@ -698,6 +681,25 @@ func Test_statusline_showcmd_cmd_mapping()
   endtry
 endfunc
 
+func Test_statusline_showcmd_nop_map()
+  CheckRunVimInTerminal
+
+  let lines =<< trim END
+    set timeoutlen=500 showcmdloc=statusline laststatus=2
+    nnoremap <space> <nop>
+    nnoremap <space><space> <nop>
+  END
+  call writefile(lines, 'XTest_statusline_showcmd_nop', 'D')
+
+  let buf = RunVimInTerminal('-S XTest_statusline_showcmd_nop', {'rows': 6})
+  call term_sendkeys(buf, ' ')
+  call WaitForAssert({-> assert_match('<20>', term_getline(buf, 5))}, 400)
+  sleep 500m
+  call WaitForAssert({-> assert_notmatch('<20>', term_getline(buf, 5))}, 400)
+
+  call StopVimInTerminal(buf)
+endfunc
+
 func Test_statusline_highlight_group_cleared()
   CheckScreendump
 
index 7ae06024892c49d38af6c2b6e46e91f5badd4b71..c2863554c447e03b7f472c8f04386a0f2ebeb6b2 100644 (file)
@@ -213,6 +213,24 @@ func Test_tabline_showcmd()
   call StopVimInTerminal(buf)
 endfunc
 
+func Test_tabline_showcmd_redraw_tabline()
+  CheckRunVimInTerminal
+
+  let lines =<< trim END
+    set showcmd showcmdloc=tabline showtabline=2 tabline=%S timeoutlen=0
+    nnoremap g :redraw<CR>
+    nnoremap gc <Nop>
+  END
+  call writefile(lines, 'XTest_tabline_showcmd_redraw', 'D')
+
+  let buf = RunVimInTerminal('-S XTest_tabline_showcmd_redraw', #{rows: 6, cols: 40})
+  call term_sendkeys(buf, 'g')
+  call WaitForAssert({-> assert_match(':redraw', term_getline(buf, 6))})
+  call WaitForAssert({-> assert_notmatch('^:', term_getline(buf, 1))})
+
+  call StopVimInTerminal(buf)
+endfunc
+
 func TruncTabLine()
   return '%1T口口%2Ta' .. repeat('b', &columns - 4) .. '%999X%#TabLine#c'
 endfunc
index 4808dfa6d055b4a1e8f49183ba5d4d5e77209fca..7a37a44ea2faea8ddb94f3d39552838b5beb228d 100644 (file)
@@ -758,6 +758,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    855,
 /**/
     854,
 /**/