summaryrefslogtreecommitdiff
path: root/src/ex_cmds.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2015-03-24 11:46:30 +0100
committerBram Moolenaar <Bram@vim.org>2015-03-24 11:46:30 +0100
commiteab316bdf9494eb1e076dfc5c8ec7ae000a0560f (patch)
treec7465d7034f6d752e569810b381bba462950f7fb /src/ex_cmds.c
parent77b7710d4e0ec9c1f3d0d057d9fa335420273b37 (diff)
downloadvim-git-eab316bdf9494eb1e076dfc5c8ec7ae000a0560f.tar.gz
updated for version 7.4.675v7.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)
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r--src/ex_cmds.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 314a46699..ef0ec1ffe 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -3185,7 +3185,7 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin)
#endif
int retval = FAIL;
long n;
- linenr_T lnum;
+ pos_T orig_pos;
linenr_T topline = 0;
int newcol = -1;
int solcol = -1;
@@ -3678,7 +3678,7 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin)
* Careful: open_buffer() and apply_autocmds() may change the current
* buffer and window.
*/
- lnum = curwin->w_cursor.lnum;
+ orig_pos = curwin->w_cursor;
topline = curwin->w_topline;
if (!oldbuf) /* need to read the file */
{
@@ -3719,11 +3719,9 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin)
check_arg_idx(curwin);
#endif
- /*
- * If autocommands change the cursor position or topline, we should
- * keep it.
- */
- if (curwin->w_cursor.lnum != lnum)
+ /* If autocommands change the cursor position or topline, we should
+ * keep it. Also when it moves within a line. */
+ if (!equalpos(curwin->w_cursor, orig_pos))
{
newlnum = curwin->w_cursor.lnum;
newcol = curwin->w_cursor.col;