summaryrefslogtreecommitdiffstats
path: root/src/ex_cmds.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-09-19 18:20:08 +0100
committerBram Moolenaar <Bram@vim.org>2022-09-19 18:20:08 +0100
commita2b91036d12e1b406ed5d17bf03f8d1ed05221f6 (patch)
treed14bd92d1fe7e688651c01ae175c1c623607a98f /src/ex_cmds.c
parentfaf1d412f5e3665021500b528c0e7301eb02bf0b (diff)
patch 9.0.0506: line number argument for :badd does not workv9.0.0506
Problem: Line number argument for :badd does not work. Solution: Set the last cursor position in the new buffer. (closes #11161)
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r--src/ex_cmds.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 9fdbe955e0..265927c4cd 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -2651,8 +2651,13 @@ do_ecmd(
// with the current window.
newbuf = buflist_new(ffname, sfname, tlnum,
BLN_LISTED | BLN_NOCURWIN);
- if (newbuf != NULL && (flags & ECMD_ALTBUF))
- curwin->w_alt_fnum = newbuf->b_fnum;
+ if (newbuf != NULL)
+ {
+ if (flags & ECMD_ALTBUF)
+ curwin->w_alt_fnum = newbuf->b_fnum;
+ if (tlnum > 0)
+ newbuf->b_last_cursor.lnum = tlnum;
+ }
goto theend;
}
buf = buflist_new(ffname, sfname, 0L,