diff options
| author | Teddy Wing | 2021-08-19 20:39:39 +0200 |
|---|---|---|
| committer | Teddy Wing | 2021-08-19 20:41:22 +0200 |
| commit | 79513cbf26a436a5a62fe6f88cfa768001756549 (patch) | |
| tree | 880788c423eedd77c469cd6b2a76a01205a4ca7b /incdec.pm | |
| parent | 5f9ff73aa5f0e0a271e36010364f3b5f914b47fe (diff) | |
| download | readline-incdec-79513cbf26a436a5a62fe6f88cfa768001756549.tar.bz2 | |
incdec: Get backward-search incrementing working for last number
Doesn't work for middle numbers yet.
Diffstat (limited to 'incdec.pm')
| -rw-r--r-- | incdec.pm | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -10,12 +10,31 @@ sub incdec { $is_backward ||= 0; my $start_position = 0; + my @points = (); + my $previous_match_start = 0; while ($line =~ /(\d+)/g) { + if ($is_backward) { + $previous_match_start = $-[0]; + + # if $point_position < $-[0] + # && previous $+[0] <= $point_position + # if ($point_position >= $-[0]) { + # $start_position = $-[0]; + # + # last; + # } + } + else { if ($point_position < $+[0]) { $start_position = $-[0]; last; } + } + } + + if ($is_backward) { + $start_position = $previous_match_start; } pos($line) = $start_position; |
