]> granicus.if.org Git - vim/commitdiff
patch 9.0.0667: ml_get error when 'splitkeep' is "screen" v9.0.0667
authorLuuk van Baal <luukvbaal@gmail.com>
Wed, 5 Oct 2022 17:26:42 +0000 (18:26 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 5 Oct 2022 17:26:42 +0000 (18:26 +0100)
Problem:    ml_get error when 'splitkeep' is "screen". (Marius Gedminas)
Solution:   Check the botline is not too large. (Luuk van Baal,
            closes #11293, closes #11292)

src/testdir/test_window_cmd.vim
src/version.c
src/window.c

index 771875757dcf41f88e9e8f09dcec06d27625cfe1..61daa8d5c24377cf16ce9ab1af19da3554c5bfbb 100644 (file)
@@ -1807,6 +1807,13 @@ function Test_splitkeep_misc()
   let top = line('w0')
   help | quit
   call assert_equal(top, line('w0'))
+  " No error when resizing window in autocmd and buffer length changed
+  autocmd FileType qf exe "resize" line('$')
+  cexpr getline(1, '$')
+  copen
+  wincmd p
+  norm dd
+  cexpr getline(1, '$')
 
   %bwipeout!
   set splitbelow&
index 925cb22fb0f49921a98dbb5a9e89679c4a427d2d..0d3e911e023fce82f97b746f3748b0424e09adde 100644 (file)
@@ -699,6 +699,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    667,
 /**/
     666,
 /**/
index 79ff5a4269505d97979ed48b9973832f0de0d8e3..1f3f9ad668d4ca5b65f42b2e5bedd6ac17d39ecb 100644 (file)
@@ -6356,7 +6356,8 @@ win_fix_scroll(int resize)
        if (wp->w_height != wp->w_prev_height)
        {
            // If window has moved update botline to keep the same screenlines.
-           if (*p_spk == 's' && wp->w_winrow != wp->w_prev_winrow)
+           if (*p_spk == 's' && wp->w_winrow != wp->w_prev_winrow
+                     && wp->w_botline - 1 <= wp->w_buffer->b_ml.ml_line_count)
            {
                lnum = wp->w_cursor.lnum;
                diff = (wp->w_winrow - wp->w_prev_winrow)