aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2021-08-15 19:33:56 +0200
committerTeddy Wing2021-08-15 19:34:27 +0200
commit84bd09dcc58f3e6f64928b818ed65b8f6344fd23 (patch)
tree35fe0ef13bc85cbaee6bef47ab1f29a588158110
parentc03cb253bf0400654ea5a1ac9e06be7e6275eab8 (diff)
downloadreadline-incdec-84bd09dcc58f3e6f64928b818ed65b8f6344fd23.tar.bz2
incdec: Clean up code from recent middle-of-number changes
Remove work-in-progress, debug code, and things that didn't work out.
-rw-r--r--incdec.pm46
1 files changed, 1 insertions, 45 deletions
diff --git a/incdec.pm b/incdec.pm
index 5a631c2..3f4c8ef 100644
--- a/incdec.pm
+++ b/incdec.pm
@@ -1,8 +1,6 @@
use strict;
use warnings;
-# use 5.010;
-
package incdec;
sub incdec {
@@ -15,46 +13,10 @@ sub incdec {
# If point is within a number, move it to ensure we match the whole number
# rather than only part of its digits.
- my $final_line = '';
+ my $line_start = '';
my $line_part = $line;
- # my $previous_point_position = $point_position;
my $previous_point_position = 0;
- $final_line .= substr($line_part, $previous_point_position);
- # while (1) {
- # for (my $i = 0; $i < 3; $i++) {
- # while ($point_position < length($line_part)) {
- # # do {
- # $line_part =~ /(\d+)/;
- # say "$-[0]:$+[0]...$line_part...";
- # if ($-[0] <= $point_position && $point_position < $+[0]) {
- # $point_position = $-[0];
- #
- # last;
- # }
- #
- # # if ($point_position >= length($line_part)) {
- # # last;
- # # }
- # # elsif ($point_position >= $+[0]) {
- # if ($point_position >= $+[0]) {
- # # repeat loop
- # $final_line .= substr($line, $previous_point_position, $point_position + 1);
- # $line_part = substr $line_part, $point_position;
- # next;
- # }
- # else {
- # last;
- # }
- #
- # # $line_part = substr $line_part, $point_position;
- # }
- # } while ($point_position < length($line_part));
-
- my $line_start = '';
- # while ($line_part =~ /(\d+)/) {
while ($point_position < length($line_part)) {
- my $len = length($line_part);
- # print "p[$line_part]p{$point_position:$len}";
$line_part =~ /(\d+)/;
if ($-[0] <= $point_position && $point_position < $+[0]) {
$point_position = $-[0];
@@ -75,19 +37,13 @@ sub incdec {
}
}
- # my $line_part = substr $line, $point_position;
-
$line_part =~ s/(\d+)/$1+1/e;
my $line_excluded = substr $line_start, 0, $original_point_position;
- # print "x[$line_excluded]x[$line_part]x";
$line = $line_excluded . $line_part;
return $line;
-
- # return $line_part;
- # return $final_line;
}
1;