diff options
| author | Teddy Wing | 2021-08-19 21:49:21 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2021-08-19 21:50:46 +0200 | 
| commit | 463490a1857274ebf5b488c38e1a280a4d9b7669 (patch) | |
| tree | fc549d7541b0e460222f83ee0ed9270281ff1cf4 /incdec.pm | |
| parent | f676809de186ffd7bda7492f912c607a3aaa0c86 (diff) | |
| download | readline-incdec-463490a1857274ebf5b488c38e1a280a4d9b7669.tar.bz2 | |
incdec: Clean up code from backwards incrementing development
Diffstat (limited to 'incdec.pm')
| -rw-r--r-- | incdec.pm | 19 | 
1 files changed, 6 insertions, 13 deletions
| @@ -10,19 +10,12 @@ sub incdec {  	$is_backward ||= 0;  	my $start_position = 0; -	my @points = ();  	my $previous_match_start = 0;  	my $previous_match_end = 0; -	print "$line\n";  	while ($line =~ /(\d+)/g) {  		if ($is_backward) { -			print "pos[$point_position] -[$-[0]]- +[$+[0]]+\n"; -			print "pos[$point_position] -[$previous_match_start]- +[$previous_match_end]+\n"; -			# if $point_position < $-[0] -			# && previous $+[0] <= $point_position -			if ($previous_match_end - 1 <= $point_position && $point_position < $-[0]) { -			# if ($-[0] <= $point_position && $point_position < $+[0]) { -				print "matched at $-[0];$previous_match_end\n"; +			if ($previous_match_end - 1 <= $point_position +					&& $point_position < $-[0]) {  				$start_position = $previous_match_start;  				last; @@ -32,11 +25,11 @@ sub incdec {  			$previous_match_end = $+[0];  		}  		else { -		if ($point_position < $+[0]) { -			$start_position = $-[0]; +			if ($point_position < $+[0]) { +				$start_position = $-[0]; -			last; -		} +				last; +			}  		}  	} | 
