aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2021-08-08 20:49:13 +0200
committerTeddy Wing2021-08-08 20:49:13 +0200
commit3c499b509196b246be487700149295c9ccf2bee8 (patch)
treeb5a7994bd90a7e1e80fde408bd2f404e1a683765
parent5950add03889fc9a8cb6faface53903cebf3a206 (diff)
downloadreadline-incdec-3c499b509196b246be487700149295c9ccf2bee8.tar.bz2
incdec: Fix increment when cursor is after the first number
* Needed the comparison to be `<`, otherwise the cursor becomes part of the first number. * The boolean operation was wrong: `$point_position` needs to be both above the start of the match and below the end of the match to be inside it.
-rw-r--r--incdec.pm3
1 files changed, 1 insertions, 2 deletions
diff --git a/incdec.pm b/incdec.pm
index e8efe0b..d2982c4 100644
--- a/incdec.pm
+++ b/incdec.pm
@@ -10,9 +10,8 @@ sub incdec {
$is_backward ||= 0;
$line =~ /(\d+)/;
- # print $-[0] . ':' . $+[0] . ';' . $point_position;
- if ($-[0] <= $point_position || $point_position <= $+[0]) {
+ if ($-[0] <= $point_position && $point_position < $+[0]) {
$point_position = $-[0];
}