diff --git a/bin/ed b/bin/ed index 91fb3263..5e9fc7aa 100755 --- a/bin/ed +++ b/bin/ed @@ -105,7 +105,7 @@ my $NO_QUESTIONS_MODE = 0; my $PRINT_NUM = 1; my $PRINT_BIN = 2; -our $VERSION = '0.22'; +our $VERSION = '0.23'; my @ESC = ( '\\000', '\\001', '\\002', '\\003', '\\004', '\\005', '\\006', '\\a', @@ -974,7 +974,12 @@ sub edParse { sub getAddr { my $n; - if (s/\A([\-\^\+]+)//) { # '++--' == current+0 + if (s/\A([\-\+])([0-9]+)//) { # '+1' or '-1' + my $is_neg = $1 eq '-'; + my $x = $2; + $x = -$x if $is_neg; + $n = $CurrentLineNum + $x; + } elsif (s/\A([\-\^\+]+)//) { # '++--' == current+0 $n = $CurrentLineNum; foreach my $c (split //, $1) { $n += $c eq '+' ? 1 : -1;