mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:7.4.313
Problem: Changing the return value of getpos() causes an error. (Jie Zhu) Solution: Revert getpos() and add getcurpos(). https://code.google.com/p/vim/source/detail?r=332a5c2b2956d9b18d85268a724d01deea27ec83
This commit is contained in:
parent
27f423e734
commit
e32d338c87
@ -6387,6 +6387,7 @@ static struct fst {
|
|||||||
{"getcmdline", 0, 0, f_getcmdline},
|
{"getcmdline", 0, 0, f_getcmdline},
|
||||||
{"getcmdpos", 0, 0, f_getcmdpos},
|
{"getcmdpos", 0, 0, f_getcmdpos},
|
||||||
{"getcmdtype", 0, 0, f_getcmdtype},
|
{"getcmdtype", 0, 0, f_getcmdtype},
|
||||||
|
{"getcurpos", 0, 0, f_getcurpos},
|
||||||
{"getcwd", 0, 0, f_getcwd},
|
{"getcwd", 0, 0, f_getcwd},
|
||||||
{"getfontname", 0, 1, f_getfontname},
|
{"getfontname", 0, 1, f_getfontname},
|
||||||
{"getfperm", 1, 1, f_getfperm},
|
{"getfperm", 1, 1, f_getfperm},
|
||||||
@ -9378,10 +9379,7 @@ static void f_getpid(typval_T *argvars, typval_T *rettv)
|
|||||||
rettv->vval.v_number = os_get_pid();
|
rettv->vval.v_number = os_get_pid();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
static void getpos_both(typval_T *argvars, typval_T *rettv, bool getcurpos)
|
||||||
* "getpos(string)" function
|
|
||||||
*/
|
|
||||||
static void f_getpos(typval_T *argvars, typval_T *rettv)
|
|
||||||
{
|
{
|
||||||
pos_T *fp;
|
pos_T *fp;
|
||||||
list_T *l;
|
list_T *l;
|
||||||
@ -9389,7 +9387,11 @@ static void f_getpos(typval_T *argvars, typval_T *rettv)
|
|||||||
|
|
||||||
rettv_list_alloc(rettv);
|
rettv_list_alloc(rettv);
|
||||||
l = rettv->vval.v_list;
|
l = rettv->vval.v_list;
|
||||||
fp = var2fpos(&argvars[0], TRUE, &fnum);
|
if (getcurpos) {
|
||||||
|
fp = &curwin->w_cursor;
|
||||||
|
} else {
|
||||||
|
fp = var2fpos(&argvars[0], true, &fnum);
|
||||||
|
}
|
||||||
list_append_number(l, (fnum != -1) ? (varnumber_T)fnum : (varnumber_T)0);
|
list_append_number(l, (fnum != -1) ? (varnumber_T)fnum : (varnumber_T)0);
|
||||||
list_append_number(l, (fp != NULL) ? (varnumber_T)fp->lnum : (varnumber_T)0);
|
list_append_number(l, (fp != NULL) ? (varnumber_T)fp->lnum : (varnumber_T)0);
|
||||||
list_append_number(l,
|
list_append_number(l,
|
||||||
@ -9398,11 +9400,27 @@ static void f_getpos(typval_T *argvars, typval_T *rettv)
|
|||||||
: (varnumber_T)0);
|
: (varnumber_T)0);
|
||||||
list_append_number(l,
|
list_append_number(l,
|
||||||
(fp != NULL) ? (varnumber_T)fp->coladd : (varnumber_T)0);
|
(fp != NULL) ? (varnumber_T)fp->coladd : (varnumber_T)0);
|
||||||
if (fp == &curwin->w_cursor) {
|
if (getcurpos) {
|
||||||
list_append_number(l, (varnumber_T) curwin->w_curswant + 1);
|
list_append_number(l, (varnumber_T) curwin->w_curswant + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* "getcurpos(string)" function
|
||||||
|
*/
|
||||||
|
static void f_getcurpos(typval_T *argvars, typval_T *rettv)
|
||||||
|
{
|
||||||
|
getpos_both(argvars, rettv, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* "getpos(string)" function
|
||||||
|
*/
|
||||||
|
static void f_getpos(typval_T *argvars, typval_T *rettv)
|
||||||
|
{
|
||||||
|
getpos_both(argvars, rettv, false);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* "getqflist()" and "getloclist()" functions
|
* "getqflist()" and "getloclist()" functions
|
||||||
*/
|
*/
|
||||||
|
@ -49,9 +49,9 @@ STARTTEST
|
|||||||
: $put =v:exception
|
: $put =v:exception
|
||||||
:endtry
|
:endtry
|
||||||
|
|
||||||
:$put ='{{{1 setpos/getpos'
|
:$put ='{{{1 getcurpos/setpos'
|
||||||
/^012345678
|
/^012345678
|
||||||
6l:let sp = getpos('.')
|
6l:let sp = getcurpos()
|
||||||
0:call setpos('.', sp)
|
0:call setpos('.', sp)
|
||||||
jyl:$put
|
jyl:$put
|
||||||
|
|
||||||
|
@ -9,5 +9,5 @@ func s:Testje exists: 1
|
|||||||
Bar exists: 1
|
Bar exists: 1
|
||||||
func Bar exists: 1
|
func Bar exists: 1
|
||||||
Vim(call):E116: Invalid arguments for function append
|
Vim(call):E116: Invalid arguments for function append
|
||||||
{{{1 setpos/getpos
|
{{{1 getcurpos/setpos
|
||||||
6
|
6
|
||||||
|
@ -282,7 +282,7 @@ static int included_patches[] = {
|
|||||||
//316 NA
|
//316 NA
|
||||||
315,
|
315,
|
||||||
314,
|
314,
|
||||||
//313,
|
313,
|
||||||
312,
|
312,
|
||||||
//311,
|
//311,
|
||||||
310,
|
310,
|
||||||
|
Loading…
Reference in New Issue
Block a user