patch 9.0.0506: line number argument for :badd does not work
Problem: Line number argument for :badd does not work.
Solution: Set the last cursor position in the new buffer. (closes #11161)
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 9fdbe95..265927c 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -2651,8 +2651,13 @@
// 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,