if (width > 0)
screen_puts_len(showcmd_buf, width, row,
wp->w_wincol + this_ru_col - width - 1, attr);
+ showcmd_update_clear_state();
}
}
K_RIGHTMOUSE, K_RIGHTDRAG, K_RIGHTRELEASE,
K_MOUSEDOWN, K_MOUSEUP, K_MOUSELEFT, K_MOUSERIGHT,
K_X1MOUSE, K_X1DRAG, K_X1RELEASE, K_X2MOUSE, K_X2DRAG, K_X2RELEASE,
- K_CURSORHOLD,
+ K_CURSORHOLD, K_COMMAND, K_SCRIPT_COMMAND,
0
};
display_showcmd();
}
+ void
+showcmd_update_clear_state(void)
+{
+ showcmd_is_clear = (showcmd_buf[0] == NUL);
+}
+
static void
display_showcmd(void)
{
int len = vim_strsize(showcmd_buf);
- showcmd_is_clear = (len == 0);
+ showcmd_update_clear_state();
cursor_off();
if (*p_sloc == 's')
void add_to_showcmd_c(int c);
void push_showcmd(void);
void pop_showcmd(void);
+void showcmd_update_clear_state(void);
void do_check_scrollbind(int check);
void check_scrollbind(linenr_T topline_diff, long leftcol_diff);
int find_decl(char_u *ptr, int len, int locally, int thisblock, int flags_arg);
}
ewp->w_p_crb = p_crb_save;
+ if (p_sc && STRCMP(opt_name, p_sloc) == 0)
+ showcmd_update_clear_state();
+
// Note: In the loop, build_stl_str_hl_mline() may replace stl_tmp with
// a newly allocated buffer (when "%!" evaluation occurs), freeing the
// original "stl" internally. After the loop, stl_tmp must be freed
if (width > 0)
screen_puts_len(showcmd_buf, width, 0, (int)Columns
- width - (tabcount > 1) * 2, attr_nosel);
+ showcmd_update_clear_state();
}
// Put an "X" for closing the current tab if there are several.
call StopVimInTerminal(buf)
endfunc
+func Test_statusline_showcmd_redraw_tabline()
+ CheckRunVimInTerminal
+
+ let lines =<< trim END
+ set showcmd showcmdloc=tabline showtabline=2 tabline=%S timeoutlen=0
+ nnoremap g :redraw<CR>
+ nnoremap gc <Nop>
+ END
+ call writefile(lines, 'XTest_statusline_showcmd_redraw', 'D')
+
+ let buf = RunVimInTerminal('-S XTest_statusline_showcmd_redraw', #{rows: 6, cols: 40})
+ call term_sendkeys(buf, 'g')
+ call WaitForAssert({-> assert_match(':redraw', term_getline(buf, 6))})
+ call WaitForAssert({-> assert_notmatch('^:', term_getline(buf, 1))})
+ call StopVimInTerminal(buf)
+endfunc
+
+func Test_statusline_showcmd_cmd_mapping()
+ set showcmd
+ set statusline=AAA%SBBB
+ set showcmdloc=statusline
+ try
+ let g:showcmd_statusline = ''
+ nnoremap <F3> <Cmd>let g:showcmd_statusline = <SID>get_statusline()<CR>
+ call feedkeys("\<F3>", 'xt')
+ call assert_equal('AAABBB', trim(g:showcmd_statusline))
+ let g:showcmd_statusline = ''
+ nunmap <F3>
+
+ nnoremap <F3> <ScriptCmd>let g:showcmd_statusline = <SID>get_statusline()<CR>
+ call feedkeys("\<F3>", 'xt')
+ call assert_equal('AAABBB', trim(g:showcmd_statusline))
+ finally
+ silent! nunmap <F3>
+ unlet! g:showcmd_statusline
+ set showcmd&
+ set statusline&
+ set showcmdloc&
+ endtry
+endfunc
+
func Test_statusline_highlight_group_cleared()
CheckScreendump
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 806,
/**/
805,
/**/