summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-06-09 18:04:28 +0200
committerBram Moolenaar <Bram@vim.org>2019-06-09 18:04:28 +0200
commitac2450a9a863f02a5e749f2b7058157cbf76edf8 (patch)
treef7b20a5e22260aac0c784da94aa1a4bcf040c8b4
parent80dad48c5095d30873a42ec82628bdb213125d8e (diff)
downloadvim-git-ac2450a9a863f02a5e749f2b7058157cbf76edf8.tar.gz
patch 8.1.1511: matches in a popup window are not displayed properlyv8.1.1511
Problem: Matches in a popup window are not displayed properly. Solution: Do display matches in a popup window. (closes #4517)
-rw-r--r--src/screen.c9
-rw-r--r--src/testdir/dumps/Test_popupwin_matches.dump10
-rw-r--r--src/testdir/test_popupwin.vim26
-rw-r--r--src/version.c2
4 files changed, 42 insertions, 5 deletions
diff --git a/src/screen.c b/src/screen.c
index 0a93f86ad..fae9fe7eb 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -3957,12 +3957,11 @@ win_line(
/*
* Handle highlighting the last used search pattern and matches.
* Do this for both search_hl and the match list.
- * Not in a popup window.
+ * Do not use search_hl in a popup window.
*/
cur = wp->w_match_head;
- shl_flag = FALSE;
- while ((cur != NULL || shl_flag == FALSE) && !number_only
- && !(screen_line_flags & SLF_POPUP))
+ shl_flag = (screen_line_flags & SLF_POPUP);
+ while ((cur != NULL || shl_flag == FALSE) && !number_only)
{
if (shl_flag == FALSE)
{
@@ -4438,7 +4437,7 @@ win_line(
*/
v = (long)(ptr - line);
cur = wp->w_match_head;
- shl_flag = FALSE;
+ shl_flag = (screen_line_flags & SLF_POPUP);
while (cur != NULL || shl_flag == FALSE)
{
if (shl_flag == FALSE
diff --git a/src/testdir/dumps/Test_popupwin_matches.dump b/src/testdir/dumps/Test_popupwin_matches.dump
new file mode 100644
index 000000000..ba3e72025
--- /dev/null
+++ b/src/testdir/dumps/Test_popupwin_matches.dump
@@ -0,0 +1,10 @@
+|1+0#ffffff16#e000002@2| +0#0000000#ffffff0|2@2| |3@2| @63
+>4+0#ffffff16#e000002@2| +0#0000000#ffffff0|5@2| |6+0&#ffff4012@2| +0&#ffffff0@63
+|~+0#4040ff13&| @7|╔+0#0000001#ffd7ff255|═@10|╗| +0#4040ff13#ffffff0@52
+|~| @7|║+0#0000001#ffd7ff255|1+0#ffffff16#e000002@2| +0#0000001#ffd7ff255|2@2| |3@2|║| +0#4040ff13#ffffff0@52
+|~| @7|║+0#0000001#ffd7ff255|4@2| |5+0#ffffff16#e000002@2| +0#0000001#ffd7ff255|6@2|║| +0#4040ff13#ffffff0@52
+|~| @7|╚+0#0000001#ffd7ff255|═@10|╝| +0#4040ff13#ffffff0@52
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|2|,|1| @10|A|l@1|
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index 5983dfb47..f275a4937 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -188,6 +188,32 @@ func Test_popup_with_syntax_setbufvar()
call delete('XtestPopup')
endfunc
+func Test_popup_with_matches()
+ if !CanRunVimInTerminal()
+ throw 'Skipped: cannot make screendumps'
+ endif
+ let lines =<< trim END
+ call setline(1, ['111 222 333', '444 555 666'])
+ let winid = popup_create([
+ \ '111 222 333',
+ \ '444 555 666',
+ \], {'line': 3, 'col': 10, 'border': []})
+ set hlsearch
+ /666
+ call matchadd('ErrorMsg', '111')
+ call matchadd('ErrorMsg', '444')
+ call win_execute(winid, "call matchadd('ErrorMsg', '111')")
+ call win_execute(winid, "call matchadd('ErrorMsg', '555')")
+ END
+ call writefile(lines, 'XtestPopupMatches')
+ let buf = RunVimInTerminal('-S XtestPopupMatches', {'rows': 10})
+ call VerifyScreenDump(buf, 'Test_popupwin_matches', {})
+
+ " clean up
+ call StopVimInTerminal(buf)
+ call delete('XtestPopupMatches')
+endfunc
+
func Test_popup_all_corners()
if !CanRunVimInTerminal()
throw 'Skipped: cannot make screendumps'
diff --git a/src/version.c b/src/version.c
index 79faf7b7d..97dc393c5 100644
--- a/src/version.c
+++ b/src/version.c
@@ -778,6 +778,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1511,
+/**/
1510,
/**/
1509,