Skip to content

Commit ac2450a

Browse files
committed
patch 8.1.1511: matches in a popup window are not displayed properly
Problem: Matches in a popup window are not displayed properly. Solution: Do display matches in a popup window. (closes #4517)
1 parent 80dad48 commit ac2450a

4 files changed

Lines changed: 42 additions & 5 deletions

File tree

src/screen.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3957,12 +3957,11 @@ win_line(
39573957
/*
39583958
* Handle highlighting the last used search pattern and matches.
39593959
* Do this for both search_hl and the match list.
3960-
* Not in a popup window.
3960+
* Do not use search_hl in a popup window.
39613961
*/
39623962
cur = wp->w_match_head;
3963-
shl_flag = FALSE;
3964-
while ((cur != NULL || shl_flag == FALSE) && !number_only
3965-
&& !(screen_line_flags & SLF_POPUP))
3963+
shl_flag = (screen_line_flags & SLF_POPUP);
3964+
while ((cur != NULL || shl_flag == FALSE) && !number_only)
39663965
{
39673966
if (shl_flag == FALSE)
39683967
{
@@ -4438,7 +4437,7 @@ win_line(
44384437
*/
44394438
v = (long)(ptr - line);
44404439
cur = wp->w_match_head;
4441-
shl_flag = FALSE;
4440+
shl_flag = (screen_line_flags & SLF_POPUP);
44424441
while (cur != NULL || shl_flag == FALSE)
44434442
{
44444443
if (shl_flag == FALSE
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
|1+0#ffffff16#e000002@2| +0#0000000#ffffff0|2@2| |3@2| @63
2+
>4+0#ffffff16#e000002@2| +0#0000000#ffffff0|5@2| |6+0&#ffff4012@2| +0&#ffffff0@63
3+
|~+0#4040ff13&| @7|╔+0#0000001#ffd7ff255|═@10|╗| +0#4040ff13#ffffff0@52
4+
|~| @7|║+0#0000001#ffd7ff255|1+0#ffffff16#e000002@2| +0#0000001#ffd7ff255|2@2| |3@2|║| +0#4040ff13#ffffff0@52
5+
|~| @7|║+0#0000001#ffd7ff255|4@2| |5+0#ffffff16#e000002@2| +0#0000001#ffd7ff255|6@2|║| +0#4040ff13#ffffff0@52
6+
|~| @7|╚+0#0000001#ffd7ff255|═@10|╝| +0#4040ff13#ffffff0@52
7+
|~| @73
8+
|~| @73
9+
|~| @73
10+
| +0#0000000&@56|2|,|1| @10|A|l@1|

src/testdir/test_popupwin.vim

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,32 @@ func Test_popup_with_syntax_setbufvar()
188188
call delete('XtestPopup')
189189
endfunc
190190

191+
func Test_popup_with_matches()
192+
if !CanRunVimInTerminal()
193+
throw 'Skipped: cannot make screendumps'
194+
endif
195+
let lines =<< trim END
196+
call setline(1, ['111 222 333', '444 555 666'])
197+
let winid = popup_create([
198+
\ '111 222 333',
199+
\ '444 555 666',
200+
\], {'line': 3, 'col': 10, 'border': []})
201+
set hlsearch
202+
/666
203+
call matchadd('ErrorMsg', '111')
204+
call matchadd('ErrorMsg', '444')
205+
call win_execute(winid, "call matchadd('ErrorMsg', '111')")
206+
call win_execute(winid, "call matchadd('ErrorMsg', '555')")
207+
END
208+
call writefile(lines, 'XtestPopupMatches')
209+
let buf = RunVimInTerminal('-S XtestPopupMatches', {'rows': 10})
210+
call VerifyScreenDump(buf, 'Test_popupwin_matches', {})
211+
212+
" clean up
213+
call StopVimInTerminal(buf)
214+
call delete('XtestPopupMatches')
215+
endfunc
216+
191217
func Test_popup_all_corners()
192218
if !CanRunVimInTerminal()
193219
throw 'Skipped: cannot make screendumps'

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,8 @@ static char *(features[]) =
777777

778778
static int included_patches[] =
779779
{ /* Add new patch number below this line */
780+
/**/
781+
1511,
780782
/**/
781783
1510,
782784
/**/

0 commit comments

Comments
 (0)