aboutsummaryrefslogtreecommitdiffstats
path: root/incdec.m4.pl
diff options
context:
space:
mode:
authorTeddy Wing2021-08-28 22:07:19 +0200
committerTeddy Wing2021-08-28 22:07:19 +0200
commitc8fa19d038ed79c640c5164735179611e95520d6 (patch)
treead987741fd3fdd66342992cf6140f699a7a7b17d /incdec.m4.pl
parent729cdbe8c41598aaa70c7c71d708953dd72a6866 (diff)
downloadreadline-incdec-c8fa19d038ed79c640c5164735179611e95520d6.tar.bz2
incdec.bash: Set up point moving after start position
This doesn't work yet as it turns out it requires a change to the `incdec()` Perl subroutine. We want to move point when switching between positive and negative numbers (adding or removing a hypen negative sign), but only if point is on or after the start of the number being incremented. If point is before that, it looks like it's moving. Read the start index from the `incdec()` subroutine and prefix it to the output line in the format: "${start_position}#${output_line}". We can then use the "#" to split the two values and extract them in the Bash functions. Needed to move setting `$READLINE_LINE` to the increment and decrement Bash functions because I now run `__readline_incdec` in a subshell, meaning the current line can't be manipulated with that variable in that function. In the increment and decrement Bash functions, we now check if the start position of the incremented number is less than or equal to `$READLINE_POINT` before trying to move point.
Diffstat (limited to 'incdec.m4.pl')
-rw-r--r--incdec.m4.pl2
1 files changed, 1 insertions, 1 deletions
diff --git a/incdec.m4.pl b/incdec.m4.pl
index b5d3c72..cd31dc5 100644
--- a/incdec.m4.pl
+++ b/incdec.m4.pl
@@ -6,4 +6,4 @@ my ($output, $start_position) = incdec(
$point_position,
$backward
);
-print $output;
+print "$start_position\#$output";