[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: g/x/s/x/x prints every substituted line twice
From: |
Rene Kita |
Subject: |
Re: g/x/s/x/x prints every substituted line twice |
Date: |
Sat, 20 Apr 2024 20:53:42 +0200 |
On Fri, Apr 19, 2024 at 06:50:45PM -0400, Douglas McIlroy wrote:
> There's nothing special about all those x's. g/x/s/y/z misbehaves, too.
> Related commands produce no such surprises:
> s/x/x prints once if successful
> s/x/x/ doesn't print
> s/x/x/p prints once if successful
> g/x/s/x/x/ doesn't print
> g/x/s/x/x/p prints substituted lines once
>
> observed in versions 1.18 and 1.20.1
JFTR, can't reproduce in 1.17.
Running ed in gdb and setting a breakpoint on exec_command shows 5 hits
for version > 1.17 and 3 hits for 1.17 for a buffer with two lines '1x'
and '2x'.
In Version 1.18 I see exec_command called two times with ibufpp pointing
to a '\n'.
HTH