diff options
author | Daniel Hahler <git@thequod.de> | 2019-08-25 20:53:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-25 20:53:17 +0200 |
commit | bec2336231f434948fcd17b35b67584234785996 (patch) | |
tree | c652210623667462a63f8c0432e01ac003a1a72d /src | |
parent | c8fc285db60decb020c180622613d3880cbefbfe (diff) | |
download | rneovim-bec2336231f434948fcd17b35b67584234785996.tar.gz rneovim-bec2336231f434948fcd17b35b67584234785996.tar.bz2 rneovim-bec2336231f434948fcd17b35b67584234785996.zip |
vim-patch:8.1.1913: not easy to compute the space on the command line (#10845)
Problem: Not easy to compute the space on the command line.
Solution: Add v:echospace. (Daniel Hahler, closes vim/vim#4732)
https://github.com/vim/vim/commit/37f4cbd46f5a6f2dd3a48d5fa4324dce37e4bd6c
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/eval.c | 3 | ||||
-rw-r--r-- | src/nvim/eval.h | 1 | ||||
-rw-r--r-- | src/nvim/option.c | 1 | ||||
-rw-r--r-- | src/nvim/testdir/test_messages.vim | 17 |
4 files changed, 22 insertions, 0 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 06254953cb..e59d6ee78e 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -419,6 +419,7 @@ static struct vimvar { VV(VV_TYPE_DICT, "t_dict", VAR_NUMBER, VV_RO), VV(VV_TYPE_FLOAT, "t_float", VAR_NUMBER, VV_RO), VV(VV_TYPE_BOOL, "t_bool", VAR_NUMBER, VV_RO), + VV(VV_ECHOSPACE, "echospace", VAR_NUMBER, VV_RO), VV(VV_EXITING, "exiting", VAR_NUMBER, VV_RO), }; #undef VV @@ -635,6 +636,8 @@ void eval_init(void) set_vim_var_special(VV_NULL, kSpecialVarNull); set_vim_var_special(VV_EXITING, kSpecialVarNull); + set_vim_var_nr(VV_ECHOSPACE, sc_col - 1); + set_reg_var(0); // default for v:register is not 0 but '"' } diff --git a/src/nvim/eval.h b/src/nvim/eval.h index abe032a96e..e099de831a 100644 --- a/src/nvim/eval.h +++ b/src/nvim/eval.h @@ -115,6 +115,7 @@ typedef enum { VV_TYPE_DICT, VV_TYPE_FLOAT, VV_TYPE_BOOL, + VV_ECHOSPACE, VV_EXITING, } VimVarIndex; diff --git a/src/nvim/option.c b/src/nvim/option.c index 699f17acc5..c109e4e521 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -5456,6 +5456,7 @@ void comp_col(void) if (ru_col <= 0) { ru_col = 1; } + set_vim_var_nr(VV_ECHOSPACE, sc_col - 1); } // Unset local option value, similar to ":set opt<". diff --git a/src/nvim/testdir/test_messages.vim b/src/nvim/testdir/test_messages.vim index 8b71d5f03e..265dee66ce 100644 --- a/src/nvim/testdir/test_messages.vim +++ b/src/nvim/testdir/test_messages.vim @@ -64,3 +64,20 @@ func Test_message_completion() call feedkeys(":message \<C-A>\<C-B>\"\<CR>", 'tx') call assert_equal('"message clear', @:) 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 |