diff options
| author | Teddy Wing | 2021-08-29 00:45:33 +0200 |
|---|---|---|
| committer | Teddy Wing | 2021-08-29 00:48:35 +0200 |
| commit | 40289847cae91a317a660d38ec4c6a48164f58f6 (patch) | |
| tree | e3807f32df9753629f63cc452230d82afe78d64b | |
| parent | e56b8c2e88c8c5444f66634dbe3c511a5f37a3d6 (diff) | |
| download | readline-incdec-40289847cae91a317a660d38ec4c6a48164f58f6.tar.bz2 | |
incdec.pm: Clean up code from previous start position commit
| -rw-r--r-- | incdec.bash | 11 | ||||
| -rw-r--r-- | incdec.pm | 11 |
2 files changed, 4 insertions, 18 deletions
diff --git a/incdec.bash b/incdec.bash index 0b8eae3..4b621f7 100644 --- a/incdec.bash +++ b/incdec.bash @@ -31,7 +31,6 @@ sub incdec { $is_backward ||= 0; my $start_position = 0; - # my $previous_match_start = $point_position; my $previous_match_start = 0; my $i = 0; while ($line =~ /(-?\d+)/g) { @@ -67,14 +66,8 @@ sub incdec { } } - # Using `\G` when `pos` is 0 seems to cause occasional missed substitutions. - # if ($start_position > 0) { - pos($line) = $start_position; - $line =~ s/\G(-?\d+)/$1 + $increment_by/e; - # } - # else { - # $line =~ s/(-?\d+)/$1 + $increment_by/e; - # } + pos($line) = $start_position; + $line =~ s/\G(-?\d+)/$1 + $increment_by/e; return ($line, $start_position); } @@ -28,7 +28,6 @@ sub incdec { $is_backward ||= 0; my $start_position = 0; - # my $previous_match_start = $point_position; my $previous_match_start = 0; my $i = 0; while ($line =~ /(-?\d+)/g) { @@ -64,14 +63,8 @@ sub incdec { } } - # Using `\G` when `pos` is 0 seems to cause occasional missed substitutions. - # if ($start_position > 0) { - pos($line) = $start_position; - $line =~ s/\G(-?\d+)/$1 + $increment_by/e; - # } - # else { - # $line =~ s/(-?\d+)/$1 + $increment_by/e; - # } + pos($line) = $start_position; + $line =~ s/\G(-?\d+)/$1 + $increment_by/e; return ($line, $start_position); } |
