Mercurial > vim
changeset 6702:d879db7c2f56 v7.4.675
updated for version 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)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Tue, 24 Mar 2015 11:46:30 +0100 |
parents | 716601181d66 |
children | 4013f16b97eb |
files | src/ex_cmds.c src/version.c |
diffstat | 2 files changed, 7 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -3185,7 +3185,7 @@ do_ecmd(fnum, ffname, sfname, eap, newln #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, newln * 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, newln 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;