File tree Expand file tree Collapse file tree 4 files changed +45
-1
lines changed
Expand file tree Collapse file tree 4 files changed +45
-1
lines changed Original file line number Diff line number Diff line change @@ -254,7 +254,11 @@ set_buffer_lines(
254254 && wp -> w_cursor .lnum > append_lnum )
255255 wp -> w_cursor .lnum += added ;
256256 check_cursor_col ();
257- update_topline ();
257+
258+ // Only update the window view if w_buffer matches curbuf, otherwise
259+ // the computations will be wrong.
260+ if (curwin -> w_buffer == curbuf )
261+ update_topline ();
258262 }
259263
260264done :
Original file line number Diff line number Diff line change 1+ |1+0&#ffffff0| @73
2+ |2| @73
3+ |3| @73
4+ |4| @73
5+ >5| @35|0+0#0000001#ffd7ff255| +0#0000000#ffffff0@36
6+ |~+0#4040ff13&| @35|1+0#0000001#ffd7ff255| +0#4040ff13#ffffff0@36
7+ |!+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
8+ | +0#0000000#ffffff0@36|3+0#0000001#ffd7ff255| +0#0000000#ffffff0@36
9+ |~+0#4040ff13&| @35|4+0#0000001#ffd7ff255| +0#4040ff13#ffffff0@36
10+ |~| @35| +0#0000001#ffd7ff255| +0#4040ff13#ffffff0@36
11+ |~| @73
12+ |~| @73
13+ |~| @73
14+ |[+1#0000000&|N|o| |N|a|m|e|]| @47|0|,|0|-|1| @9|A|l@1
15+ | +0&&@74
Original file line number Diff line number Diff line change @@ -4174,5 +4174,28 @@ func Test_bufdel_skips_popupwin_buffer()
41744174 call popup_close (id)
41754175endfunc
41764176
4177+ func Test_term_popup_bufline ()
4178+ " very specific situation where a non-existing buffer line is used, leading
4179+ " to an ml_get error
4180+ CheckScreendump
4181+
4182+ let lines = << trim END
4183+ vim9script
4184+ &scrolloff = 5
4185+ term_start (' seq 1 5' , {term_finish: ' open' })
4186+ timer_start (50 , (_) = > {
4187+ set cpoptions &vim
4188+ var buf = popup_create ([], {})- >winbufnr ()
4189+ appendbufline (buf , 0 , range (5 ))
4190+ })
4191+ END
4192+ call writefile (lines , ' XtestTermPopup' , ' D' )
4193+ let buf = RunVimInTerminal (' -S XtestTermPopup' , #{rows: 15 })
4194+ call VerifyScreenDump (buf , ' Test_term_popup_bufline' , {})
4195+
4196+ " clean up
4197+ call StopVimInTerminal (buf )
4198+ endfunc
4199+
41774200
41784201" vim: shiftwidth = 2 sts = 2
Original file line number Diff line number Diff line change @@ -703,6 +703,8 @@ static char *(features[]) =
703703
704704static int included_patches [] =
705705{ /* Add new patch number below this line */
706+ /**/
707+ 416 ,
706708/**/
707709 415 ,
708710/**/
You can’t perform that action at this time.
0 commit comments