Index | Thread | Search

From:
Walter Alejandro Iglesias <wai@roquesor.com>
Subject:
Re: vi(1) bug executing buffer with range fixed
To:
jerry <mail@jerryfletcher.org>
Cc:
tech@openbsd.org
Date:
Sun, 7 Sep 2025 10:44:56 +0200

Download raw body.

Thread
On Sat, Sep 06, 2025 at 11:15:34PM +0200, jerry wrote:
> Hello,
> 
> while using vi(1) I found a bug related to executing buffers that I
> managed to fix.
> The bug happens also in nvi(1) from ports.
> This bug is related to executing the content of a buffer specifying a
> range, that is a feature documented in the code, but not in the man
> page nor in the reference manual, so I also added some documentations.
> 
> The steps that cause the bug:
> * copy to a buffer some ex commands, for example to buffer a: s/^/# /
> * execute the buffer specifying a range -> :.,+10@a
> * try to undo the changes -> u
> 
> Undoing the changes will result in just the last line being undone,
> and in order to undo all the lines the . will have to be pressed
> many times.
> The correct behaviour should be as if executing directly :.,+10s/^/# /
> then doing u, so restoring all the lines changed.
> 

I tested the patch, it works for me.  Thanks!