Patch 8.1.1913
Problem:    Not easy to compute the space on the command line.
Solution:   Add v:echospace. (Daniel Hahler, closes #4732)
Files:      src/vim.h, src/eval.c, src/option.c, runtime/doc/eval.txt,
            src/testdir/test_messages.vim


*** ../vim-8.1.1912/src/vim.h   2019-08-21 22:25:26.030016778 +0200
--- src/vim.h   2019-08-23 20:18:15.650817462 +0200
***************
*** 1981,1987 ****
  #define VV_TERMBLINKRESP 89
  #define VV_EVENT      90
  #define VV_VERSIONLONG        91
! #define VV_LEN                92      // number of v: vars
  
  // used for v_number in VAR_SPECIAL
  #define VVAL_FALSE    0L
--- 1981,1988 ----
  #define VV_TERMBLINKRESP 89
  #define VV_EVENT      90
  #define VV_VERSIONLONG        91
! #define VV_ECHOSPACE  92
! #define VV_LEN                93      // number of v: vars
  
  // used for v_number in VAR_SPECIAL
  #define VVAL_FALSE    0L
*** ../vim-8.1.1912/src/eval.c  2019-08-20 21:57:57.652689478 +0200
--- src/eval.c  2019-08-23 20:19:29.082460163 +0200
***************
*** 201,206 ****
--- 201,207 ----
      {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,394 ****
--- 390,397 ----
      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
*** ../vim-8.1.1912/src/option.c        2019-08-22 21:23:17.679357091 +0200
--- src/option.c        2019-08-23 20:20:19.026217531 +0200
***************
*** 10881,10886 ****
--- 10881,10889 ----
      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)
*** ../vim-8.1.1912/runtime/doc/eval.txt        2019-08-22 22:18:12.708452709 
+0200
--- runtime/doc/eval.txt        2019-08-23 20:34:41.598914215 +0200
***************
*** 1768,1773 ****
--- 1768,1780 ----
  <             Note: if another deadly signal is caught when v:dying is one,
                VimLeave autocommands will not be executed.
  
+                                       *v:echospace* *echospace-variable*
+ v:echospace   Number of screen cells that can be used for an `:echo` message
+               in the last screen line before causing the |hit-enter-prompt|.
+               Depends on 'showcmd', 'ruler' and 'columns'.  You need to
+               check 'cmdheight' for whether there are full-width lines
+               available above the last line.
+ 
                                        *v:errmsg* *errmsg-variable*
  v:errmsg      Last given error message.  It's allowed to set this variable.
                Example: >
*** ../vim-8.1.1912/src/testdir/test_messages.vim       2019-06-24 
00:58:02.908020514 +0200
--- src/testdir/test_messages.vim       2019-08-23 20:36:35.534422861 +0200
***************
*** 155,157 ****
--- 155,174 ----
    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
*** ../vim-8.1.1912/src/version.c       2019-08-22 22:54:51.851603883 +0200
--- src/version.c       2019-08-23 20:23:26.165574909 +0200
***************
*** 763,764 ****
--- 763,766 ----
  {   /* Add new patch number below this line */
+ /**/
+     1913,
  /**/

-- 
To be rich is not the end, but only a change of worries.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/201908231859.x7NIxNrG031565%40masaka.moolenaar.net.

Raspunde prin e-mail lui