Skip to content

Commit

Permalink
vim-patch:9.1.0145: v:echospace not correct when 'showcmdloc' != last (
Browse files Browse the repository at this point in the history
…neovim#27682)

Problem:  the amount of available space (v:echospace) on the command
          line is not correct when showcmdloc is drawn into the
          statusline or tabline.
Solution: only add SHOWCMD_COLS to the shown command column when
          'showcmdloc' is set to last (Sam-programs)

closes: vim/vim#14108

vim/vim@062141b

Co-authored-by: Sam-programs <[email protected]>
  • Loading branch information
zeertzjq and Sam-programs authored Feb 29, 2024
1 parent 57e5b9f commit 5d4e169
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/nvim/drawscreen.c
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,7 @@ void comp_col(void)
sc_col = ru_col;
}
}
if (p_sc) {
if (p_sc && *p_sloc == 'l') {
sc_col += SHOWCMD_COLS;
if (!p_ru || last_has_status) { // no need for separating space
sc_col++;
Expand Down
1 change: 1 addition & 0 deletions src/nvim/optionstr.c
Original file line number Diff line number Diff line change
Expand Up @@ -2100,6 +2100,7 @@ const char *did_set_showbreak(optset_T *args)
/// The 'showcmdloc' option is changed.
const char *did_set_showcmdloc(optset_T *args FUNC_ATTR_UNUSED)
{
comp_col();
return did_set_opt_strings(p_sloc, p_sloc_values, true);
}

Expand Down
6 changes: 5 additions & 1 deletion test/old/testdir/test_messages.vim
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,12 @@ func Test_echospace()
call assert_equal(&columns - 12, v:echospace)
set showcmd ruler
call assert_equal(&columns - 29, v:echospace)
set showcmdloc=statusline
call assert_equal(&columns - 19, v:echospace)
set showcmdloc=tabline
call assert_equal(&columns - 19, v:echospace)

set ruler& showcmd&
set ruler& showcmd& showcmdloc&
endfunc

func Test_warning_scroll()
Expand Down

0 comments on commit 5d4e169

Please sign in to comment.