mirror of
https://github.com/vim/vim.git
synced 2025-10-11 06:34:16 -04:00
patch 8.1.1913: not easy to compute the space on the command line
Problem: Not easy to compute the space on the command line. Solution: Add v:echospace. (Daniel Hahler, closes #4732)
This commit is contained in:
@@ -201,6 +201,7 @@ static struct vimvar
|
||||
{VV_NAME("termblinkresp", VAR_STRING), VV_RO},
|
||||
{VV_NAME("event", VAR_DICT), VV_RO},
|
||||
{VV_NAME("versionlong", VAR_NUMBER), VV_RO},
|
||||
{VV_NAME("echospace", VAR_NUMBER), VV_RO},
|
||||
};
|
||||
|
||||
/* shorthand */
|
||||
@@ -389,6 +390,8 @@ eval_init(void)
|
||||
set_vim_var_nr(VV_TYPE_CHANNEL, VAR_TYPE_CHANNEL);
|
||||
set_vim_var_nr(VV_TYPE_BLOB, VAR_TYPE_BLOB);
|
||||
|
||||
set_vim_var_nr(VV_ECHOSPACE, sc_col - 1);
|
||||
|
||||
set_reg_var(0); /* default for v:register is not 0 but '"' */
|
||||
|
||||
#ifdef EBCDIC
|
||||
|
@@ -10881,6 +10881,9 @@ comp_col(void)
|
||||
sc_col = Columns;
|
||||
ru_col = Columns;
|
||||
#endif
|
||||
#ifdef FEAT_EVAL
|
||||
set_vim_var_nr(VV_ECHOSPACE, sc_col - 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) || defined(PROTO)
|
||||
|
@@ -155,3 +155,20 @@ func Test_mode_message_at_leaving_insert_with_esc_mapped()
|
||||
exe buf . 'bwipe!'
|
||||
call delete(testfile)
|
||||
endfunc
|
||||
|
||||
func Test_echospace()
|
||||
set noruler noshowcmd laststatus=1
|
||||
call assert_equal(&columns - 1, v:echospace)
|
||||
split
|
||||
call assert_equal(&columns - 1, v:echospace)
|
||||
set ruler
|
||||
call assert_equal(&columns - 1, v:echospace)
|
||||
close
|
||||
call assert_equal(&columns - 19, v:echospace)
|
||||
set showcmd noruler
|
||||
call assert_equal(&columns - 12, v:echospace)
|
||||
set showcmd ruler
|
||||
call assert_equal(&columns - 29, v:echospace)
|
||||
|
||||
set ruler& showcmd&
|
||||
endfunc
|
||||
|
@@ -761,6 +761,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1913,
|
||||
/**/
|
||||
1912,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user