aboutsummaryrefslogtreecommitdiffstats
path: root/incdec.pm
diff options
context:
space:
mode:
Diffstat (limited to 'incdec.pm')
-rw-r--r--incdec.pm7
1 files changed, 7 insertions, 0 deletions
diff --git a/incdec.pm b/incdec.pm
index 2dfeb74..e8efe0b 100644
--- a/incdec.pm
+++ b/incdec.pm
@@ -9,6 +9,13 @@ sub incdec {
$point_position ||= 0;
$is_backward ||= 0;
+ $line =~ /(\d+)/;
+ # print $-[0] . ':' . $+[0] . ';' . $point_position;
+
+ if ($-[0] <= $point_position || $point_position <= $+[0]) {
+ $point_position = $-[0];
+ }
+
my $line_part = substr $line, $point_position;
$line_part =~ s/(\d+)/$1+1/e;