Steps to reproduce the bug:
echo "A
B
C
D" > file
ed file << END
1
i
a
.
w
q
END
---
 editors/ed.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/editors/ed.c b/editors/ed.c
index 4a84f7433808..de40614bb213 100644
--- a/editors/ed.c
+++ b/editors/ed.c
@@ -346,6 +346,8 @@ static int insertLine(int num, const char *data, int len)
        lp->prev = newLp;
 
        lastNum++;
+       if (curNum > 0 && curNum >= num)
+               curNum++;
        dirty = TRUE;
        return setCurNum(num);
 }
-- 
2.37.2

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to