// highlight empty match, try again after
// it
if (has_mbyte)
- shl->endcol += (*mb_ptr2len)(*line + shl->endcol);
+ {
+ char_u *p = *line + shl->endcol;
+
+ if (*p == NUL)
+ // consistent with non-mbyte
+ ++shl->endcol;
+ else
+ shl->endcol += (*mb_ptr2len)(p);
+ }
else
++shl->endcol;
}
int prevcol_hl_flag = FALSE;
matchitem_T *cur; // points to the match list
+#if defined(FEAT_PROP_POPUP)
+ // don't do this in a popup window
+ if (popup_is_popup(wp))
+ return FALSE;
+#endif
+
// we're not really at that column when skipping some text
if ((long)(wp->w_p_wrap ? wp->w_skipcol : wp->w_leftcol) > prevcol)
++prevcol;
- if (!search_hl->is_addpos && prevcol == (long)search_hl->startcol)
+ // Highlight a character after the end of the line if the match started
+ // at the end of the line or when the match continues in the next line
+ // (match includes the line break).
+ if (!search_hl->is_addpos && (prevcol == (long)search_hl->startcol
+ || (prevcol > (long)search_hl->startcol
+ && search_hl->endcol == MAXCOL)))
prevcol_hl_flag = TRUE;
else
{
cur = wp->w_match_head;
while (cur != NULL)
{
- if (!cur->hl.is_addpos && prevcol == (long)cur->hl.startcol)
+ if (!cur->hl.is_addpos && (prevcol == (long)cur->hl.startcol
+ || (prevcol > (long)cur->hl.startcol
+ && cur->hl.endcol == MAXCOL)))
{
prevcol_hl_flag = TRUE;
break;
--- /dev/null
+|x+0&#ffff4012@2| | +0&#ffffff0@45
+>x+8&#ffff4012@2| | +8&#ffffff0@45
+|x+0&#ffff4012@2| | +0&#ffffff0@45
+|~+0#4040ff13&| @48
+|~| @48
+| +0#0000000&@31|2|,|1| @10|A|l@1|
--- /dev/null
+|x+0&#ffff4012@2| | +0&#ffffff0@45
+|x+0&#ffff4012@2| | +0&#ffffff0@45
+>x+8&#ffff4012@2| | +8&#ffffff0@45
+|~+0#4040ff13&| @48
+|~| @48
+|/+0#0000000&|\|_|.|*| @26|3|,|1| @10|A|l@1|
call delete('Xis_search_script')
endfunc
+func Test_hlsearch_dump()
+ CheckOption hlsearch
+ CheckScreendump
+
+ call writefile([
+ \ 'set hlsearch cursorline',
+ \ 'call setline(1, ["xxx", "xxx", "xxx"])',
+ \ '/.*',
+ \ '2',
+ \ ], 'Xhlsearch_script')
+ let buf = RunVimInTerminal('-S Xhlsearch_script', {'rows': 6, 'cols': 50})
+ call VerifyScreenDump(buf, 'Test_hlsearch_1', {})
+
+ call term_sendkeys(buf, "/\\_.*\<CR>")
+ call VerifyScreenDump(buf, 'Test_hlsearch_2', {})
+
+ call StopVimInTerminal(buf)
+ call delete('Xhlsearch_script')
+endfunc
+
func Test_incsearch_substitute()
CheckOption incsearch
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 2542,
/**/
2541,
/**/