Commit: patch 9.2.0855: 'showcmd' not redrawn with empty mapping triggered on timeout

Christian Brabandt <[email protected]>
Newsgroups gmane.editors.vim.devel
Message-ID <[email protected]>
patch 9.2.0855: 'showcmd' not redrawn with empty mapping triggered on timeout

Commit: https://github.com/vim/vim/commit/2e9687647a2ab2aadee00f01e37c71a5cffbdfcc
Author: zeertzjq <[email protected]>
Date:   Sat Jul 25 16:46:29 2026 +0000

    patch 9.2.0855: 'showcmd' not redrawn with empty mapping triggered on timeout
    
    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 <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/normal.c b/src/normal.c
index d5de6abe5..a7959d62f 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -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();
diff --git a/src/testdir/test_statusline.vim b/src/testdir/test_statusline.vim
index 69699a2d4..6df015be1 100644
--- a/src/testdir/test_statusline.vim
+++ b/src/testdir/test_statusline.vim
@@ -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
 
diff --git a/src/testdir/test_tabline.vim b/src/testdir/test_tabline.vim
index 7ae060248..c2863554c 100644
--- a/src/testdir/test_tabline.vim
+++ b/src/testdir/test_tabline.vim
@@ -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
diff --git a/src/version.c b/src/version.c
index 4808dfa6d..7a37a44ea 100644
--- a/src/version.c
+++ b/src/version.c
@@ -758,6 +758,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    855,
 /**/
     854,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1wnfjJ-00DYfg-4g%40256bit.org.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.