]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0598: tests: Test_statusline() is flaky v9.2.0598
authorHirohito Higashi <h.east.727@gmail.com>
Fri, 5 Jun 2026 11:46:00 +0000 (11:46 +0000)
committerChristian Brabandt <cb@256bit.org>
Fri, 5 Jun 2026 11:46:00 +0000 (11:46 +0000)
Problem:  Test_statusline() occasionally fails in CI, reading buffer text
          instead of the status line (e.g. '9012...' instead of '57,39').
Solution: In s:get_statusline() redraw unconditionally and read the screen
          cells directly with screenstring(), instead of relying on
          ScreenLines() whose own redraw! can process events and change the
          window layout between the redraw and reading the cells.  This
          matches the already-stable s:Assert_match_statusline() helper in
          test_statuslineopt.vim.

closes: #20428

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/testdir/test_statusline.vim
src/version.c

index 48c7bb669681f2719dab75de46a36bd16b80728e..d4267ee929432f8e3065b4c5c53419ec2e3df866 100644 (file)
@@ -14,11 +14,15 @@ func TearDown()
 endfunc
 
 func s:get_statusline()
+  redraw!
   if has('gui_running')
-    redraw!
     sleep 1m
   endif
-  return ScreenLines(&lines - 1, &columns)[0]
+  " Read the screen directly after redraw! instead of going through
+  " ScreenLines(), whose own redraw! may process events and change the window
+  " layout between here and the screenstring() calls.
+  let row = &lines - 1
+  return join(map(range(1, &columns), 'screenstring(row, v:val)'), '')
 endfunc
 
 func StatuslineWithCaughtError()
index 81bd8d09f405a7266eb7559a13823429020faddf..25903a8edef264a2488df634061f9cd69abd25b7 100644 (file)
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    598,
 /**/
     597,
 /**/