[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: [PATCH] vi: ':r' should insert text after current line
From: Denys Vlasenko <vda.linux () googlemail ! com>
Date: 2021-06-14 18:59:22
Message-ID: CAK1hOcOp1OoyRT9YEb7=hkBPo4sdHSCV6_rEW+4SO+49CGoBtQ () mail ! gmail ! com
[Download RAW message or body]
Applied, thanks
On Wed, Jun 9, 2021 at 5:11 PM Ron Yorston <rmy@pobox.com> wrote:
>
> When no line number is specified ':read' should place the inserted
> text after the current line, not before.
>
> This used to be correct but was broken when commit 0c42a6b07
> (vi: fix empty line range regression) revealed a bug in commit
> 7a8ceb4eb (vi: changes to line addresses for colon commands).
>
> function old new delta
> colon 3960 3952 -8
> ------------------------------------------------------------------------------
> (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-8) Total: -8 bytes
>
> Signed-off-by: Ron Yorston <rmy@pobox.com>
> ---
> editors/vi.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/editors/vi.c b/editors/vi.c
> index d85cdd98d..05a3795a3 100644
> --- a/editors/vi.c
> +++ b/editors/vi.c
> @@ -2997,12 +2997,10 @@ static void colon(char *buf)
> status_line_bold("No current filename");
> goto ret;
> }
> - if (e < 0) { // no addr given- read after current line
> - q = begin_line(dot);
> - } else if (e == 0) { // user said ":0r foo"
> + if (e == 0) { // user said ":0r foo"
> q = text;
> - } else { // addr given- read after that line
> - q = next_line(find_line(e));
> + } else { // read after given line or current line if none given
> + q = next_line(e > 0 ? find_line(e) : dot);
> // read after last line
> if (q == end-1)
> ++q;
> --
> 2.31.1
>
> _______________________________________________
> busybox mailing list
> busybox@busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic