mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:7.4.675
Problem: When a FileReadPost autocommand moves the cursor inside a line it
gets moved back.
Solution: When checking whether an autocommand moved the cursor store the
column as well. (Christian Brabandt)
eab316bdf9
This commit is contained in:
parent
1946f96a16
commit
e1abbe6b67
@ -1989,7 +1989,7 @@ do_ecmd (
|
|||||||
char_u *free_fname = NULL;
|
char_u *free_fname = NULL;
|
||||||
int retval = FAIL;
|
int retval = FAIL;
|
||||||
long n;
|
long n;
|
||||||
linenr_T lnum;
|
pos_T orig_pos;
|
||||||
linenr_T topline = 0;
|
linenr_T topline = 0;
|
||||||
int newcol = -1;
|
int newcol = -1;
|
||||||
int solcol = -1;
|
int solcol = -1;
|
||||||
@ -2351,7 +2351,7 @@ do_ecmd (
|
|||||||
* Careful: open_buffer() and apply_autocmds() may change the current
|
* Careful: open_buffer() and apply_autocmds() may change the current
|
||||||
* buffer and window.
|
* buffer and window.
|
||||||
*/
|
*/
|
||||||
lnum = curwin->w_cursor.lnum;
|
orig_pos = curwin->w_cursor;
|
||||||
topline = curwin->w_topline;
|
topline = curwin->w_topline;
|
||||||
if (!oldbuf) { /* need to read the file */
|
if (!oldbuf) { /* need to read the file */
|
||||||
swap_exists_action = SEA_DIALOG;
|
swap_exists_action = SEA_DIALOG;
|
||||||
@ -2379,11 +2379,9 @@ do_ecmd (
|
|||||||
}
|
}
|
||||||
check_arg_idx(curwin);
|
check_arg_idx(curwin);
|
||||||
|
|
||||||
/*
|
// If autocommands change the cursor position or topline, we should keep
|
||||||
* If autocommands change the cursor position or topline, we should
|
// it. Also when it moves within a line.
|
||||||
* keep it.
|
if (!equalpos(curwin->w_cursor, orig_pos)) {
|
||||||
*/
|
|
||||||
if (curwin->w_cursor.lnum != lnum) {
|
|
||||||
newlnum = curwin->w_cursor.lnum;
|
newlnum = curwin->w_cursor.lnum;
|
||||||
newcol = curwin->w_cursor.col;
|
newcol = curwin->w_cursor.col;
|
||||||
}
|
}
|
||||||
|
@ -318,7 +318,7 @@ static int included_patches[] = {
|
|||||||
// 678 NA
|
// 678 NA
|
||||||
// 677 NA
|
// 677 NA
|
||||||
// 676 NA
|
// 676 NA
|
||||||
// 675,
|
675,
|
||||||
// 674 NA
|
// 674 NA
|
||||||
673,
|
673,
|
||||||
// 672,
|
// 672,
|
||||||
|
Loading…
Reference in New Issue
Block a user