* over the join without changing visible characters.
* - Cells where the vsep char is drawn (stl_connected == FALSE) are left
* untouched so the VertSplit highlight is preserved.
+ * Called for every cursor movement, thus only cells whose attribute changed
+ * are written to the screen.
*/
static void
borrow_stl_vsep_hl(void)
for (int r = start; r < end; r++)
{
- unsigned dst_off = LineOffset[r] + dst_col;
+ unsigned dst_off = LineOffset[r] + dst_col;
+ sattr_T attr = ScreenAttrs[LineOffset[r] + src_col];
- ScreenAttrs[dst_off] = ScreenAttrs[LineOffset[r] + src_col];
- screen_char(dst_off, r, dst_col);
+ if (ScreenAttrs[dst_off] != attr)
+ {
+ ScreenAttrs[dst_off] = attr;
+ screen_char(dst_off, r, dst_col);
+ }
}
}
}
}
#if defined(FEAT_STL_OPT)
if ((*p_stl != NUL || *curwin->w_p_stl != NUL) && curwin->w_status_height)
+ {
redraw_custom_statusline(curwin);
+ borrow_stl_vsep_hl();
+ }
else
#endif
win_redr_ruler(curwin, always, FALSE);
--- /dev/null
+|a+0&#ffffff0@2| @35||+1&&>a+0&&@2| @34
+|b@2| @35||+1&&|b+0&&@2| @34
+|~+0#4040ff13&| @37||+1#0000000&|~+0#4040ff13&| @36
+|~| @37||+1#0000000&|~+0#4040ff13&| @36
+|N+2(ff4011|O|R|M|A|L| @32| +0&&|N|O|R|M|A|L| @31
+| +0#0000000#ffffff0@77
--- /dev/null
+|a+0&#ffffff0@2| @35||+1&&>a+0&&@2| @34
+|b@2| @35||+1&&|b+0&&@2| @34
+|~+0#4040ff13&| @37||+1#0000000&|~+0#4040ff13&| @36
+|~| @37||+1#0000000&|~+0#4040ff13&| @36
+|N+2(ff4011|O|R|M|A|L| @32| +0#ff404010#ffff4012|I|N|S|E|R|T| @31
+|-+2#0000000#ffffff0@1| |I|N|S|E|R|T| |-@1| +0&&@65
call StopVimInTerminal(buf)
endfunc
+func Test_statusline_vsep_borrow_hl_mode_change()
+ CheckScreendump
+
+ " With 'statusline' set, a mode change repaints the status line through
+ " showruler(). The vsep cell must follow without another key press.
+ let lines =<< trim END
+ hi User1 ctermfg=Red ctermbg=Yellow
+ hi User2 ctermfg=Blue ctermbg=Green
+ set laststatus=2
+ func MyStl()
+ return mode() ==# 'i' ? '%1*INSERT' : '%2*NORMAL'
+ endfunc
+ set statusline=%!MyStl()
+ call setline(1, ['aaa', 'bbb'])
+ vsplit
+ wincmd w
+ END
+ call writefile(lines, 'XTest_statusline_vsep_mode', 'D')
+
+ let buf = RunVimInTerminal('-S XTest_statusline_vsep_mode',
+ \ {'rows': 6, 'cols': 78})
+ call term_sendkeys(buf, "\<C-L>")
+ call VerifyScreenDump(buf, 'Test_statusline_vsep_borrow_hl_mode_01', {})
+
+ call term_sendkeys(buf, "i")
+ call VerifyScreenDump(buf, 'Test_statusline_vsep_borrow_hl_mode_02', {})
+
+ " Leaving Insert mode restores the state of the first dump.
+ call term_sendkeys(buf, "\<Esc>")
+ call VerifyScreenDump(buf, 'Test_statusline_vsep_borrow_hl_mode_01', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 913,
/**/
912,
/**/