mirror of
https://github.com/neovim/neovim.git
synced 2025-10-02 07:58:35 +00:00
@@ -1,6 +1,6 @@
|
|||||||
" Vim plugin for showing matching parens
|
" Vim plugin for showing matching parens
|
||||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||||
" Last Change: 2014 Jul 19
|
" Last Change: 2015 Dec 31
|
||||||
|
|
||||||
" Exit quickly when:
|
" Exit quickly when:
|
||||||
" - this plugin was already loaded (or disabled)
|
" - this plugin was already loaded (or disabled)
|
||||||
@@ -55,7 +55,7 @@ function! s:Highlight_Matching_Pair()
|
|||||||
let before = 0
|
let before = 0
|
||||||
|
|
||||||
let text = getline(c_lnum)
|
let text = getline(c_lnum)
|
||||||
let matches = matchlist(text, '\(.\)\=\%'.c_col.'c\(.\)')
|
let matches = matchlist(text, '\(.\)\=\%'.c_col.'c\(.\=\)')
|
||||||
if empty(matches)
|
if empty(matches)
|
||||||
let [c_before, c] = ['', '']
|
let [c_before, c] = ['', '']
|
||||||
else
|
else
|
||||||
|
@@ -8337,6 +8337,7 @@ static void f_cursor(typval_T *argvars, typval_T *rettv)
|
|||||||
{
|
{
|
||||||
long line, col;
|
long line, col;
|
||||||
long coladd = 0;
|
long coladd = 0;
|
||||||
|
bool set_curswant = true;
|
||||||
|
|
||||||
rettv->vval.v_number = -1;
|
rettv->vval.v_number = -1;
|
||||||
if (argvars[1].v_type == VAR_UNKNOWN) {
|
if (argvars[1].v_type == VAR_UNKNOWN) {
|
||||||
@@ -8353,30 +8354,35 @@ static void f_cursor(typval_T *argvars, typval_T *rettv)
|
|||||||
coladd = pos.coladd;
|
coladd = pos.coladd;
|
||||||
if (curswant >= 0) {
|
if (curswant >= 0) {
|
||||||
curwin->w_curswant = curswant - 1;
|
curwin->w_curswant = curswant - 1;
|
||||||
|
set_curswant = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
line = get_tv_lnum(argvars);
|
line = get_tv_lnum(argvars);
|
||||||
col = get_tv_number_chk(&argvars[1], NULL);
|
col = get_tv_number_chk(&argvars[1], NULL);
|
||||||
if (argvars[2].v_type != VAR_UNKNOWN)
|
if (argvars[2].v_type != VAR_UNKNOWN) {
|
||||||
coladd = get_tv_number_chk(&argvars[2], NULL);
|
coladd = get_tv_number_chk(&argvars[2], NULL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (line < 0 || col < 0
|
if (line < 0 || col < 0
|
||||||
|| coladd < 0
|
|| coladd < 0) {
|
||||||
)
|
return; // type error; errmsg already given
|
||||||
return; /* type error; errmsg already given */
|
}
|
||||||
if (line > 0)
|
if (line > 0) {
|
||||||
curwin->w_cursor.lnum = line;
|
curwin->w_cursor.lnum = line;
|
||||||
if (col > 0)
|
}
|
||||||
|
if (col > 0) {
|
||||||
curwin->w_cursor.col = col - 1;
|
curwin->w_cursor.col = col - 1;
|
||||||
|
}
|
||||||
curwin->w_cursor.coladd = coladd;
|
curwin->w_cursor.coladd = coladd;
|
||||||
|
|
||||||
/* Make sure the cursor is in a valid position. */
|
// Make sure the cursor is in a valid position.
|
||||||
check_cursor();
|
check_cursor();
|
||||||
/* Correct cursor for multi-byte character. */
|
// Correct cursor for multi-byte character.
|
||||||
if (has_mbyte)
|
if (has_mbyte) {
|
||||||
mb_adjust_cursor();
|
mb_adjust_cursor();
|
||||||
|
}
|
||||||
|
|
||||||
curwin->w_set_curswant = TRUE;
|
curwin->w_set_curswant = set_curswant;
|
||||||
rettv->vval.v_number = 0;
|
rettv->vval.v_number = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -14682,27 +14688,32 @@ static void f_setpos(typval_T *argvars, typval_T *rettv)
|
|||||||
name = get_tv_string_chk(argvars);
|
name = get_tv_string_chk(argvars);
|
||||||
if (name != NULL) {
|
if (name != NULL) {
|
||||||
if (list2fpos(&argvars[1], &pos, &fnum, &curswant) == OK) {
|
if (list2fpos(&argvars[1], &pos, &fnum, &curswant) == OK) {
|
||||||
if (--pos.col < 0)
|
if (--pos.col < 0) {
|
||||||
pos.col = 0;
|
pos.col = 0;
|
||||||
|
}
|
||||||
if (name[0] == '.' && name[1] == NUL) {
|
if (name[0] == '.' && name[1] == NUL) {
|
||||||
/* set cursor */
|
// set cursor
|
||||||
if (fnum == curbuf->b_fnum) {
|
if (fnum == curbuf->b_fnum) {
|
||||||
curwin->w_cursor = pos;
|
curwin->w_cursor = pos;
|
||||||
if (curswant >= 0) {
|
if (curswant >= 0) {
|
||||||
curwin->w_curswant = curswant - 1;
|
curwin->w_curswant = curswant - 1;
|
||||||
|
curwin->w_set_curswant = false;
|
||||||
}
|
}
|
||||||
check_cursor();
|
check_cursor();
|
||||||
rettv->vval.v_number = 0;
|
rettv->vval.v_number = 0;
|
||||||
} else
|
} else {
|
||||||
EMSG(_(e_invarg));
|
EMSG(_(e_invarg));
|
||||||
|
}
|
||||||
} else if (name[0] == '\'' && name[1] != NUL && name[2] == NUL) {
|
} else if (name[0] == '\'' && name[1] != NUL && name[2] == NUL) {
|
||||||
/* set mark */
|
// set mark
|
||||||
if (setmark_pos(name[1], &pos, fnum) == OK)
|
if (setmark_pos(name[1], &pos, fnum) == OK) {
|
||||||
rettv->vval.v_number = 0;
|
rettv->vval.v_number = 0;
|
||||||
} else
|
}
|
||||||
|
} else {
|
||||||
EMSG(_(e_invarg));
|
EMSG(_(e_invarg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -663,7 +663,7 @@ static int included_patches[] = {
|
|||||||
// 1018,
|
// 1018,
|
||||||
// 1017,
|
// 1017,
|
||||||
// 1016 NA
|
// 1016 NA
|
||||||
// 1015,
|
1015,
|
||||||
// 1014 NA
|
// 1014 NA
|
||||||
1013,
|
1013,
|
||||||
// 1012 NA
|
// 1012 NA
|
||||||
|
Reference in New Issue
Block a user