summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-07-20 15:09:56 +0200
committerBram Moolenaar <Bram@vim.org>2019-07-20 15:09:56 +0200
commitf914a33c9c8ec5c30da684a4a16edad3e0224f0a (patch)
treeeffa3d4eefeba07d08e13a8435c7c2a435e1f6d7
parentab0a789808ecf8de8f0805ec332f69029897fdb5 (diff)
patch 8.1.1717: last char in menu popup window highlightedv8.1.1717
Problem: Last char in menu popup window highlighted. Solution: Do not highlight an extra character twice.
-rw-r--r--src/screen.c8
-rw-r--r--src/testdir/dumps/Test_popupwin_menu_04.dump10
-rw-r--r--src/testdir/test_popupwin.vim69
-rw-r--r--src/version.c2
4 files changed, 84 insertions, 5 deletions
diff --git a/src/screen.c b/src/screen.c
index fdb1e0af5b..5cffdf1304 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -3219,10 +3219,10 @@ win_line(
int syntax_attr = 0; /* attributes desired by syntax */
int has_syntax = FALSE; /* this buffer has syntax highl. */
int save_did_emsg;
- int eol_hl_off = 0; /* 1 if highlighted char after EOL */
int draw_color_col = FALSE; /* highlight colorcolumn */
int *color_cols = NULL; /* pointer to according columns array */
#endif
+ int eol_hl_off = 0; /* 1 if highlighted char after EOL */
#ifdef FEAT_TEXT_PROP
int text_prop_count;
int text_prop_next = 0; // next text property to use
@@ -5557,11 +5557,11 @@ win_line(
/*
* At end of the text line or just after the last character.
*/
- if (c == NUL
+ if ((c == NUL
#if defined(LINE_ATTR)
|| did_line_attr == 1
#endif
- )
+ ) && eol_hl_off == 0)
{
#ifdef FEAT_SEARCH_EXTRA
long prevcol = (long)(ptr - line) - (c == NUL);
@@ -5687,9 +5687,7 @@ win_line(
++off;
}
++vcol;
-#ifdef FEAT_SYN_HL
eol_hl_off = 1;
-#endif
}
}
diff --git a/src/testdir/dumps/Test_popupwin_menu_04.dump b/src/testdir/dumps/Test_popupwin_menu_04.dump
new file mode 100644
index 0000000000..bfa660cd5a
--- /dev/null
+++ b/src/testdir/dumps/Test_popupwin_menu_04.dump
@@ -0,0 +1,10 @@
+>1+0&#ffffff0| @73
+|2| @73
+|3| @31|╔+0#0000001#ffd7ff255|═@6|╗| +0#0000000#ffffff0@32
+|4| @31|║+0#0000001#ffd7ff255| |o+0#0000000#40ff4011|n|e| +0#0000001#ffd7ff255@2|║| +0#0000000#ffffff0@32
+|5| @31|║+0#0000001#ffd7ff255| |t|w|o| @2|║| +0#0000000#ffffff0@32
+|6| @31|║+0#0000001#ffd7ff255| |t|h|r|e@1| |║| +0#0000000#ffffff0@32
+|7| @31|╚+0#0000001#ffd7ff255|═@6|╝| +0#0000000#ffffff0@32
+|8| @73
+|9| @73
+@57|1|,|1| @10|T|o|p|
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index 0ec901cb59..11e4323b9b 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -1215,6 +1215,29 @@ func Test_popup_menu_screenshot()
call delete('XtestPopupMenu')
endfunc
+func Test_popup_menu_narrow()
+ if !CanRunVimInTerminal()
+ throw 'Skipped: cannot make screendumps'
+ endif
+
+ let lines =<< trim END
+ call setline(1, range(1, 20))
+ hi PopupSelected ctermbg=green
+ call popup_menu(['one', 'two', 'three'], #{callback: 'MenuDone'})
+ func MenuDone(id, res)
+ echomsg "selected " .. a:res
+ endfunc
+ END
+ call writefile(lines, 'XtestPopupNarrowMenu')
+ let buf = RunVimInTerminal('-S XtestPopupNarrowMenu', #{rows: 10})
+ call VerifyScreenDump(buf, 'Test_popupwin_menu_04', {})
+
+ " clean up
+ call term_sendkeys(buf, "x")
+ call StopVimInTerminal(buf)
+ call delete('XtestPopupNarrowMenu')
+endfunc
+
func Test_popup_title()
if !CanRunVimInTerminal()
throw 'Skipped: cannot make screendumps'
@@ -2093,4 +2116,50 @@ func Test_popup_cursorline()
call delete('XtestPopupCursorLine')
endfunc
+func Test_previewpopup()
+ if !CanRunVimInTerminal()
+ throw 'Skipped: cannot make screendumps'
+ endif
+ call writefile([
+ \ "!_TAG_FILE_ENCODING\tutf-8\t//",
+ \ "another\tXtagfile\t/^this is another",
+ \ "theword\tXtagfile\t/^theword"],
+ \ 'Xtags')
+ call writefile(range(1,20)
+ \ + ['theword is here']
+ \ + range(22, 27)
+ \ + ['this is another place']
+ \ + range(29, 40),
+ \ "Xtagfile")
+ let lines =<< trim END
+ set tags=Xtags
+ call setline(1, [
+ \ 'one',
+ \ 'two',
+ \ 'three',
+ \ 'four',
+ \ 'five',
+ \ 'six',
+ \ 'seven',
+ \ 'find theword somewhere',
+ \ 'nine',
+ \ 'this is another word'])
+ set previewpopup=height:4,width:40
+ END
+ call writefile(lines, 'XtestPreviewPopup')
+ let buf = RunVimInTerminal('-S XtestPreviewPopup', #{rows: 14})
+
+ call term_sendkeys(buf, "/theword\<CR>\<C-W>}")
+ call term_sendkeys(buf, ":\<CR>")
+ call VerifyScreenDump(buf, 'Test_popupwin_previewpopup_1', {})
+
+ call term_sendkeys(buf, "/another\<CR>\<C-W>}")
+ call VerifyScreenDump(buf, 'Test_popupwin_previewpopup_2', {})
+
+ call StopVimInTerminal(buf)
+ call delete('Xtags')
+ call delete('Xtagfile')
+ call delete('XtestPreviewPopup')
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 20fdb1ef0c..47b044f572 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 */
/**/
+ 1717,
+/**/
1716,
/**/
1715,