aboutsummaryrefslogtreecommitdiffstats
path: root/incdec.pm
diff options
context:
space:
mode:
authorTeddy Wing2021-08-22 20:55:46 +0200
committerTeddy Wing2021-08-22 20:55:46 +0200
commit250252e775486f9d60652a4b4490caac6756e767 (patch)
tree870f1aef4124b48c56e2a3d7aa4b212c73a1d098 /incdec.pm
parenta37e4cc946d2948d19040722fc5e6ea2f6e3bc17 (diff)
downloadreadline-incdec-250252e775486f9d60652a4b4490caac6756e767.tar.bz2
incdec.pm: Add descriptions for the backwards handling
Describe why we set `$point_position` the way we do.
Diffstat (limited to 'incdec.pm')
-rw-r--r--incdec.pm8
1 files changed, 8 insertions, 0 deletions
diff --git a/incdec.pm b/incdec.pm
index 364f000..1e13b21 100644
--- a/incdec.pm
+++ b/incdec.pm
@@ -23,7 +23,15 @@ sub incdec {
# && $point_position < $-[0]) {
# Try always setting $start_position and resetting it if there's another number?
+ # TODO: document, last number handling
+
+ # Set start position to the current match start. This gives us the
+ # correct start position when incrementing the last number in a
+ # line.
$start_position = $-[0];
+
+ # If point is not at the end, set start position to the number
+ # closest to the point position.
if ($point_position < $-[0]) {
# print "match at [$previous_match_start]";
$start_position = $previous_match_start;