mirror of
https://github.com/vim/vim.git
synced 2026-05-28 00:21:37 +02:00
patch 9.2.0422: popup: leave stray char when scrollbar changes
Problem: popup: leave stray char when scrollbar changes
(Maxim Kim, after v9.2.0112)
Solution: refresh popup mask when scrollbar visibility changes
(Yasuhiro Matsumoto)
popup_adjust_position() set popup_mask_refresh only on geometry
changes, missing the case where w_has_scrollbar flips. After
popup_settext() shrinks the buffer enough that the scrollbar
disappears, the cell that held the old border / scrollbar was
never repainted, leaving stray characters.
fixes: #20092
closes: #20098
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
7f3243e3a8
commit
ba85f88fe9
+3
-1
@@ -1288,6 +1288,7 @@ popup_adjust_position(win_T *wp)
|
||||
int org_height = wp->w_height;
|
||||
int org_leftcol = wp->w_leftcol;
|
||||
int org_leftoff = wp->w_popup_leftoff;
|
||||
int org_has_scrollbar = wp->w_has_scrollbar;
|
||||
int minwidth, minheight;
|
||||
int maxheight = Rows;
|
||||
int wantline = wp->w_wantline; // adjusted for textprop
|
||||
@@ -1830,7 +1831,8 @@ popup_adjust_position(win_T *wp)
|
||||
|| org_leftcol != wp->w_leftcol
|
||||
|| org_leftoff != wp->w_popup_leftoff
|
||||
|| org_width != wp->w_width
|
||||
|| org_height != wp->w_height)
|
||||
|| org_height != wp->w_height
|
||||
|| org_has_scrollbar != wp->w_has_scrollbar)
|
||||
{
|
||||
redraw_win_later(wp, UPD_NOT_VALID);
|
||||
if (wp->w_popup_flags & POPF_ON_CMDLINE)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
> +0&#ffffff0@49
|
||||
|~+0#4040ff13&| @48
|
||||
|~| @2|╔+0#0000001#ffd7ff255|═@30|╗| +0#4040ff13#ffffff0@12
|
||||
|~| @2|║+0#0000001#ffd7ff255|h|e|l@1|o| |w|o|r|l|d| @18| +0#0000000#0000001|║+0#0000001#ffd7ff255| +0#4040ff13#ffffff0@12
|
||||
|~| @2|║+0#0000001#ffd7ff255|h|e|l@1|o| |w|o|r|l|d| @18| +0#0000000#0000001|║+0#0000001#ffd7ff255| +0#4040ff13#ffffff0@12
|
||||
|~| @2|║+0#0000001#ffd7ff255|h|e|l@1|o| |w|o|r|l|d| @18| +0#0000000#0000001|║+0#0000001#ffd7ff255| +0#4040ff13#ffffff0@12
|
||||
|~| @2|║+0#0000001#ffd7ff255|h|e|l@1|o| |w|o|r|l|d| @18| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255| +0#4040ff13#ffffff0@12
|
||||
|~| @2|║+0#0000001#ffd7ff255|h|e|l@1|o| |w|o|r|l|d| @18| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255| +0#4040ff13#ffffff0@12
|
||||
|~| @2|║+0#0000001#ffd7ff255|h|e|l@1|o| |w|o|r|l|d| @18| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255| +0#4040ff13#ffffff0@12
|
||||
|~| @2|║+0#0000001#ffd7ff255|h|e|l@1|o| |w|o|r|l|d| @18| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255| +0#4040ff13#ffffff0@12
|
||||
|~| @2|║+0#0000001#ffd7ff255|h|e|l@1|o| |w|o|r|l|d| @18| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255| +0#4040ff13#ffffff0@12
|
||||
|~| @2|║+0#0000001#ffd7ff255|h|e|l@1|o| |w|o|r|l|d| @18| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255| +0#4040ff13#ffffff0@12
|
||||
|~| @2|║+0#0000001#ffd7ff255|h|e|l@1|o| |w|o|r|l|d| @18| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255| +0#4040ff13#ffffff0@12
|
||||
|~| @2|╚+0#0000001#ffd7ff255|═@30|╝| +0#4040ff13#ffffff0@12
|
||||
| +0#0000000&@31|0|,|0|-|1| @8|A|l@1|
|
||||
@@ -0,0 +1,15 @@
|
||||
> +0&#ffffff0@49
|
||||
|~+0#4040ff13&| @48
|
||||
|~| @2|╔+0#0000001#ffd7ff255|═@29|╗| +0#4040ff13#ffffff0@13
|
||||
|~| @2|║+0#0000001#ffd7ff255|s|h|o|r|t| @24|║| +0#4040ff13#ffffff0@13
|
||||
|~| @2|║+0#0000001#ffd7ff255| +0#4040ff13&@29|║+0#0000001&| +0#4040ff13#ffffff0@13
|
||||
|~| @2|║+0#0000001#ffd7ff255| +0#4040ff13&@29|║+0#0000001&| +0#4040ff13#ffffff0@13
|
||||
|~| @2|║+0#0000001#ffd7ff255| +0#4040ff13&@29|║+0#0000001&| +0#4040ff13#ffffff0@13
|
||||
|~| @2|║+0#0000001#ffd7ff255| +0#4040ff13&@29|║+0#0000001&| +0#4040ff13#ffffff0@13
|
||||
|~| @2|║+0#0000001#ffd7ff255| +0#4040ff13&@29|║+0#0000001&| +0#4040ff13#ffffff0@13
|
||||
|~| @2|║+0#0000001#ffd7ff255| +0#4040ff13&@29|║+0#0000001&| +0#4040ff13#ffffff0@13
|
||||
|~| @2|║+0#0000001#ffd7ff255| +0#4040ff13&@29|║+0#0000001&| +0#4040ff13#ffffff0@13
|
||||
|~| @2|║+0#0000001#ffd7ff255| +0#4040ff13&@29|║+0#0000001&| +0#4040ff13#ffffff0@13
|
||||
|~| @2|║+0#0000001#ffd7ff255| +0#4040ff13&@29|║+0#0000001&| +0#4040ff13#ffffff0@13
|
||||
|~| @2|╚+0#0000001#ffd7ff255|═@29|╝| +0#4040ff13#ffffff0@13
|
||||
|:+0#0000000&|c|a|l@1| |p|o|p|u|p|_|s|e|t@1|e|x|t|(|g|:|p|,| |[|'|s|h|o|r|t|0|,|0|-|1| @8|A|l@1|
|
||||
@@ -2563,6 +2563,32 @@ func Test_popup_settext()
|
||||
call StopVimInTerminal(buf)
|
||||
endfunc
|
||||
|
||||
func Test_popup_settext_scrollbar_disappear()
|
||||
CheckScreendump
|
||||
|
||||
let lines =<< trim END
|
||||
let g:p = popup_create(repeat(['hello world'], 30), #{
|
||||
\ line: 3,
|
||||
\ col: 5,
|
||||
\ pos: 'topleft',
|
||||
\ minheight: 10,
|
||||
\ maxheight: 10,
|
||||
\ minwidth: 30,
|
||||
\ border: [1, 1, 1, 1],
|
||||
\ })
|
||||
END
|
||||
call writefile(lines, 'XtestPopupScrollDisappear', 'D')
|
||||
let buf = RunVimInTerminal('-S XtestPopupScrollDisappear', #{rows: 15, cols: 50})
|
||||
call VerifyScreenDump(buf, 'Test_popup_settext_scrollbar_disappear_1', {})
|
||||
|
||||
" Shrinking the buffer makes the scrollbar disappear. The right border
|
||||
" column must not leave stray characters where the scrollbar used to be.
|
||||
call term_sendkeys(buf, ":call popup_settext(g:p, ['short'])\<CR>")
|
||||
call VerifyScreenDump(buf, 'Test_popup_settext_scrollbar_disappear_2', {})
|
||||
|
||||
call StopVimInTerminal(buf)
|
||||
endfunc
|
||||
|
||||
func Test_popup_settext_getline()
|
||||
let id = popup_create('', #{ tabpage: 0 })
|
||||
call popup_settext(id, ['a','b'])
|
||||
|
||||
@@ -729,6 +729,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
422,
|
||||
/**/
|
||||
421,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user