Patch 9.0.0416
Problem: ml_get error when appending lines in popup window.
Solution: Only update w_topline when w_buffer matches curbuf.
(closes #11074)
Files: src/evalbuffer.c, src/testdir/test_popupwin.vim,
src/testdir/dumps/Test_term_popup_bufline.dump
*** ../vim-9.0.0415/src/evalbuffer.c 2022-08-25 15:11:11.404084538 +0100
--- src/evalbuffer.c 2022-09-08 13:36:14.896892029 +0100
***************
*** 254,260 ****
&& wp->w_cursor.lnum > append_lnum)
wp->w_cursor.lnum += added;
check_cursor_col();
! update_topline();
}
done:
--- 254,264 ----
&& wp->w_cursor.lnum > append_lnum)
wp->w_cursor.lnum += added;
check_cursor_col();
!
! // Only update the window view if w_buffer matches curbuf, otherwise
! // the computations will be wrong.
! if (curwin->w_buffer == curbuf)
! update_topline();
}
done:
*** ../vim-9.0.0415/src/testdir/test_popupwin.vim 2022-09-02 21:55:45.507049444 +0100
--- src/testdir/test_popupwin.vim 2022-09-08 13:35:04.801003354 +0100
***************
*** 4174,4178 ****
--- 4174,4201 ----
call popup_close(id)
endfunc
+ func Test_term_popup_bufline()
+ " very specific situation where a non-existing buffer line is used, leading
+ " to an ml_get error
+ CheckScreendump
+
+ let lines =<< trim END
+ vim9script
+ &scrolloff = 5
+ term_start('seq 1 5', {term_finish: 'open'})
+ timer_start(50, (_) => {
+ set cpoptions&vim
+ var buf = popup_create([], {})->winbufnr()
+ appendbufline(buf, 0, range(5))
+ })
+ END
+ call writefile(lines, 'XtestTermPopup', 'D')
+ let buf = RunVimInTerminal('-S XtestTermPopup', #{rows: 15})
+ call VerifyScreenDump(buf, 'Test_term_popup_bufline', {})
+
+ " clean up
+ call StopVimInTerminal(buf)
+ endfunc
+
" vim: shiftwidth=2 sts=2
*** ../vim-9.0.0415/src/testdir/dumps/Test_term_popup_bufline.dump 2022-09-08 13:41:34.948397540 +0100
--- src/testdir/dumps/Test_term_popup_bufline.dump 2022-09-08 13:36:27.284872494 +0100
***************
*** 0 ****
--- 1,15 ----
+ |1+0&#ffffff0| @73
+ |2| @73
+ |3| @73
+ |4| @73
+ >5| @35|0+0#0000001#ffd7ff255| +0#0000000#ffffff0@36
+ |~+0#4040ff13&| @35|1+0#0000001#ffd7ff255| +0#4040ff13#ffffff0@36
+ |!+2#ffffff16#00e0003|s|e|q| |1| |5| |[|f|i|n|i|s|h|e|d|]| @17|2+0#0000001#ffd7ff255| +2#ffffff16#00e0003@18|5|,|1| @11|A|l@1
+ | +0#0000000#ffffff0@36|3+0#0000001#ffd7ff255| +0#0000000#ffffff0@36
+ |~+0#4040ff13&| @35|4+0#0000001#ffd7ff255| +0#4040ff13#ffffff0@36
+ |~| @35| +0#0000001#ffd7ff255| +0#4040ff13#ffffff0@36
+ |~| @73
+ |~| @73
+ |~| @73
+ |[+1#0000000&|N|o| |N|a|m|e|]| @47|0|,|0|-|1| @9|A|l@1
+ | +0&&@74
*** ../vim-9.0.0415/src/version.c 2022-09-08 12:27:58.285556514 +0100
--- src/version.c 2022-09-08 13:16:22.751243320 +0100
***************
*** 705,706 ****
--- 705,708 ----
{ /* Add new patch number below this line */
+ /**/
+ 416,
/**/
--
How To Keep A Healthy Level Of Insanity:
15. Five days in advance, tell your friends you can't attend their
party because you're not in the mood.
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///