patch 9.2.0598: tests: Test_statusline() is flaky

Commit: 
https://github.com/vim/vim/commit/db3ce018b5e1b6d0fac482a52f948ba8ca3899fa
Author: Hirohito Higashi <[email protected]>
Date:   Fri Jun 5 11:46:00 2026 +0000

    patch 9.2.0598: tests: Test_statusline() is flaky
    
    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) <[email protected]>
    Signed-off-by: Hirohito Higashi <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/testdir/test_statusline.vim b/src/testdir/test_statusline.vim
index 48c7bb669..d4267ee92 100644
--- a/src/testdir/test_statusline.vim
+++ b/src/testdir/test_statusline.vim
@@ -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()
diff --git a/src/version.c b/src/version.c
index 81bd8d09f..25903a8ed 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    598,
 /**/
     597,
 /**/

-- 
-- 
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/E1wVYbP-0079Y2-T0%40256bit.org.

Raspunde prin e-mail lui