mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
updated for version 7.1-031
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
*eval.txt* For Vim version 7.1. Last change: 2007 Jun 09
|
*eval.txt* For Vim version 7.1. Last change: 2007 Jul 11
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@@ -2020,6 +2020,10 @@ col({expr}) The result is a Number, which is the byte index of the column
|
|||||||
number of characters in the cursor line plus one)
|
number of characters in the cursor line plus one)
|
||||||
'x position of mark x (if the mark is not set, 0 is
|
'x position of mark x (if the mark is not set, 0 is
|
||||||
returned)
|
returned)
|
||||||
|
Additionally {expr} can be [lnum, col]: a |List| with the line
|
||||||
|
and column number. Most useful when the column is "$", to get
|
||||||
|
the las column of a specific line. When "lnum" or "col" is
|
||||||
|
out of range then col() returns zero.
|
||||||
To get the line number use |line()|. To get both use
|
To get the line number use |line()|. To get both use
|
||||||
|getpos()|.
|
|getpos()|.
|
||||||
For the screen column position use |virtcol()|.
|
For the screen column position use |virtcol()|.
|
||||||
@@ -5024,14 +5028,12 @@ virtcol({expr}) *virtcol()*
|
|||||||
position, the returned Number will be the column at the end of
|
position, the returned Number will be the column at the end of
|
||||||
the <Tab>. For example, for a <Tab> in column 1, with 'ts'
|
the <Tab>. For example, for a <Tab> in column 1, with 'ts'
|
||||||
set to 8, it returns 8.
|
set to 8, it returns 8.
|
||||||
For the use of {expr} see |col()|. Additionally you can use
|
For the byte position use |col()|.
|
||||||
[lnum, col]: a |List| with the line and column number. When
|
For the use of {expr} see |col()|.
|
||||||
"lnum" or "col" is out of range then virtcol() returns zero.
|
When 'virtualedit' is used {expr} can be [lnum, col, off], where
|
||||||
When 'virtualedit' is used it can be [lnum, col, off], where
|
|
||||||
"off" is the offset in screen columns from the start of the
|
"off" is the offset in screen columns from the start of the
|
||||||
character. E.g., a position within a <Tab> or after the last
|
character. E.g., a position within a <Tab> or after the last
|
||||||
character.
|
character.
|
||||||
For the byte position use |col()|.
|
|
||||||
When Virtual editing is active in the current mode, a position
|
When Virtual editing is active in the current mode, a position
|
||||||
beyond the end of the line can be returned. |'virtualedit'|
|
beyond the end of the line can be returned. |'virtualedit'|
|
||||||
The accepted positions are:
|
The accepted positions are:
|
||||||
|
19
src/eval.c
19
src/eval.c
@@ -672,7 +672,7 @@ static void f_winwidth __ARGS((typval_T *argvars, typval_T *rettv));
|
|||||||
static void f_writefile __ARGS((typval_T *argvars, typval_T *rettv));
|
static void f_writefile __ARGS((typval_T *argvars, typval_T *rettv));
|
||||||
|
|
||||||
static int list2fpos __ARGS((typval_T *arg, pos_T *posp, int *fnump));
|
static int list2fpos __ARGS((typval_T *arg, pos_T *posp, int *fnump));
|
||||||
static pos_T *var2fpos __ARGS((typval_T *varp, int lnum, int *fnum));
|
static pos_T *var2fpos __ARGS((typval_T *varp, int dollar_lnum, int *fnum));
|
||||||
static int get_env_len __ARGS((char_u **arg));
|
static int get_env_len __ARGS((char_u **arg));
|
||||||
static int get_id_len __ARGS((char_u **arg));
|
static int get_id_len __ARGS((char_u **arg));
|
||||||
static int get_name_len __ARGS((char_u **arg, char_u **alias, int evaluate, int verbose));
|
static int get_name_len __ARGS((char_u **arg, char_u **alias, int evaluate, int verbose));
|
||||||
@@ -16505,9 +16505,9 @@ f_writefile(argvars, rettv)
|
|||||||
* Returns NULL when there is an error.
|
* Returns NULL when there is an error.
|
||||||
*/
|
*/
|
||||||
static pos_T *
|
static pos_T *
|
||||||
var2fpos(varp, lnum, fnum)
|
var2fpos(varp, dollar_lnum, fnum)
|
||||||
typval_T *varp;
|
typval_T *varp;
|
||||||
int lnum; /* TRUE when $ is last line */
|
int dollar_lnum; /* TRUE when $ is last line */
|
||||||
int *fnum; /* set to fnum for '0, 'A, etc. */
|
int *fnum; /* set to fnum for '0, 'A, etc. */
|
||||||
{
|
{
|
||||||
char_u *name;
|
char_u *name;
|
||||||
@@ -16520,6 +16520,7 @@ var2fpos(varp, lnum, fnum)
|
|||||||
list_T *l;
|
list_T *l;
|
||||||
int len;
|
int len;
|
||||||
int error = FALSE;
|
int error = FALSE;
|
||||||
|
listitem_T *li;
|
||||||
|
|
||||||
l = varp->vval.v_list;
|
l = varp->vval.v_list;
|
||||||
if (l == NULL)
|
if (l == NULL)
|
||||||
@@ -16535,6 +16536,14 @@ var2fpos(varp, lnum, fnum)
|
|||||||
if (error)
|
if (error)
|
||||||
return NULL;
|
return NULL;
|
||||||
len = (long)STRLEN(ml_get(pos.lnum));
|
len = (long)STRLEN(ml_get(pos.lnum));
|
||||||
|
|
||||||
|
/* We accept "$" for the column number: last column. */
|
||||||
|
li = list_find(l, 1L);
|
||||||
|
if (li != NULL && li->li_tv.v_type == VAR_STRING
|
||||||
|
&& li->li_tv.vval.v_string != NULL
|
||||||
|
&& STRCMP(li->li_tv.vval.v_string, "$") == 0)
|
||||||
|
pos.col = len + 1;
|
||||||
|
|
||||||
/* Accept a position up to the NUL after the line. */
|
/* Accept a position up to the NUL after the line. */
|
||||||
if (pos.col == 0 || (int)pos.col > len + 1)
|
if (pos.col == 0 || (int)pos.col > len + 1)
|
||||||
return NULL; /* invalid column number */
|
return NULL; /* invalid column number */
|
||||||
@@ -16567,7 +16576,7 @@ var2fpos(varp, lnum, fnum)
|
|||||||
pos.coladd = 0;
|
pos.coladd = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (name[0] == 'w' && lnum)
|
if (name[0] == 'w' && dollar_lnum)
|
||||||
{
|
{
|
||||||
pos.col = 0;
|
pos.col = 0;
|
||||||
if (name[1] == '0') /* "w0": first visible line */
|
if (name[1] == '0') /* "w0": first visible line */
|
||||||
@@ -16585,7 +16594,7 @@ var2fpos(varp, lnum, fnum)
|
|||||||
}
|
}
|
||||||
else if (name[0] == '$') /* last column or line */
|
else if (name[0] == '$') /* last column or line */
|
||||||
{
|
{
|
||||||
if (lnum)
|
if (dollar_lnum)
|
||||||
{
|
{
|
||||||
pos.lnum = curbuf->b_ml.ml_line_count;
|
pos.lnum = curbuf->b_ml.ml_line_count;
|
||||||
pos.col = 0;
|
pos.col = 0;
|
||||||
|
@@ -666,6 +666,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
31,
|
||||||
/**/
|
/**/
|
||||||
30,
|
30,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user