aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--incdec.pm19
1 files changed, 19 insertions, 0 deletions
diff --git a/incdec.pm b/incdec.pm
index 927ba92..9a26425 100644
--- a/incdec.pm
+++ b/incdec.pm
@@ -41,6 +41,25 @@ sub incdec {
}
}
+ # Idea: Loop through @- and @+ to find @- <= point < @+
+ $point_position = $original_point_position;
+ my @matches = $line =~ /(\d+)/g;
+ print "[[@matches]]";
+ # for (my $i = 0; $i < scalar @+ - 1; $i++) {
+ # print "..$-[$i]:$+[$i]..$point_position..";
+ # if ($point_position < $+[$i + 1]) {
+ # print "x[$matches[$i]]x";
+ # }
+ # }
+ for (my $i = 0; $i < scalar @- - 1; $i++) {
+ print "..$-[$i + 1]:$+[$i]..$point_position..";
+ if ($point_position > $+[$i] && $point_position <= $-[$i + 1]) {
+ print "x[$matches[$i]]x";
+ }
+ }
+
+ # Final match, final match before point
+
$line_part =~ s/(\d+)/$1+1/e;
my $line_excluded = substr $line_start, 0, $original_point_position;