| Age | Commit message (Collapse) | Author | 
|---|
|  | When I refactored the tests to add `@want` and `@got` variables, I made
a mistake with the names. Swap the two variables to make their contents
reflect the meaning of the words. | 
|  |  | 
|  |  | 
|  | No longer need this test file. | 
|  |  | 
|  |  | 
|  |  | 
|  | This works now. | 
|  |  | 
|  | Previously, if backwards was on and point was before the first number on
the line, the start position would be set to 0 (when it gets set to
`$previous_match_start`). This means the start position wouldn't get set
to the actual start position of the first number.
We want the actual start position of that number so we can move point
only if it's on or after the current number when changing between
negative and positive numbers.
Also, the `\G` pattern didn't work on some of the `sed` tests because it
matches a number at that position. Since the position wasn't one that
was followed by the number, the regex didn't match a number, and the
increment didn't happen. We can get rid of the special handling for
start position at 0 now. | 
|  | In order to set up point moving only when point is on or after the start
position of the changed number, I want the second return value from
`incdec()` to always give me the correct start position.
Currently, it returns 0 as the start position when backwards is on and
point is before the first number. It should return the start position of
the first number. | 
|  | 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. | 
|  | I want access to the start position of the number being operated on.
This will allow me to determine if point should be moved or not.
Refactor everything to accept an array from `incdec()`. | 
|  |  | 
|  | When `$start_position` was 0 going backwards, the `sed` test command
line failed to increment the first number in the line.
Can't figure out exactly what was wrong, but there seemed to be a
problem with using the `\G` assertion for that test case. Decided to
remove `\G` when `$start_position` position is 0 to work around the
problem. Not sure if there's a more concise solution to this that
wouldn't require me to have two separate subtitution lines.
Also simplified the substitution regular expression. It turns out I
didn't need the first capture group, and it was incorrect in matching
/[^-\d]*/ because we really wanted /(?!-?\d+)/, not either or of the
characters in the group. Completely removing it still allows everything
to work. Don't remember if I added that when I was still using the
substringing algorithm, but whatever happens, it's not necessary now. | 
|  | When point is before the first number, that number should be incremented
or decremented. This doesn't work correctly with more complex, real
world commands. | 
|  |  | 
|  |  | 
|  |  | 
|  |  | 
|  |  | 
|  | Add a ".bash" extension to the main include script make explicit the
intent for it to be used with Bash. | 
|  | Split the bindings from the function definitions. This will allow users
to source the functions and define their own bindings. The bindings file
can be sourced to get the default bindings. | 
|  |  | 
|  | I had used `C-x +` and `C-x -` during testing because I had an existing
non-"-x" binding that was prefixed with `C-x a`, and when I tried to add
the `C-x a` "-x" binding, it caused the following error:
    bash_execute_unix_command: cannot find keymap for command
Switch the default bindings to `C-x a` and `C-x x` because those are the
ones I originally wanted, since they don't appear to conflict with any
existing default Readline bindings, and they're similar to the Vim
increment and decrement commands. | 
|  |  | 
|  | Now that we have this working, remove the old functions, binding
definitions, and TODOs.
All TODOs here are handled. The old Bash functions and bindings were for
a Bash-only implementation. The point-moving code in
`__readline_incdec_decrement` wasn't applicable to decrementing numbers. | 
|  | Like we did for the `incdec.m4` Bash include, rename the Perl M4 file to
give it a `.pl` extension so we get Perl syntax highlighting. Similarly
define an include macro so quoting doesn't mess up highlighting. | 
|  | Put the file after the option argument since it's more common to order
them that way. | 
|  | Those caused the following errors:
    Variable "$line" is not imported at -e line 45.
    Variable "$increment_by" is not imported at -e line 45.
    Variable "$point_position" is not imported at -e line 45.
    Variable "$backward" is not imported at -e line 45.
    Global symbol "$line" requires explicit package name (did you forget to declare "my $line"?) at -e line 45.
    Global symbol "$increment_by" requires explicit package name (did you forget to declare "my $increment_by"?) at -e line 45.
    Global symbol "$point_position" requires explicit package name (did you forget to declare "my $point_position"?) at -e line 45.
    Global symbol "$backward" requires explicit package name (did you forget to declare "my $backward"?) at -e line 45.
    Execution of -e aborted due to compilation errors.
I suppose I could have kept warnings, as only strict caused the errors,
but decided to remove it anyway. Not sure what makes the most sense. | 
|  | Put build targets above the test target. | 
|  | When I changed the file to an M4 file, it removed Bash syntax
highlighting, and the `include()` call interfered with Bash quote
matching. Use a different macro to include the Perl file so we can get
Bash syntax highlighting. | 
|  | Include the built `incdec.pl` code in the Bash file by generating it
from `incdec.pm`. | 
|  | Build an intermediary Perl file that includes the extra lines that call
`incdec()`. This whole file should be included in the final Bash
function `perl -e` call. | 
|  | I created this file for testing. We no longer need it. | 
|  | Remove the debug prints when I was trying to work out the problem with
negative numbers and the last number in the line. | 
|  | This was from when I extracted the `incdec` function to a standalone
Perl script to test what was wrong with negative numbers in the second
position. | 
|  | Previously, point would stay in the same position, causing it to look
like it moved when incrementing or decrementing between a negative
number and a positive number. This moves point by one to the right when
decrementing to a negative integer, or by one to the left when
incrementing to a positive integer. That makes the point seem like it
hasn't moved and making it look more natural.
For example, now point behaves like this:
    $ test 12 0
              ^
    _decrement_
    $ test 12 -1
               ^
    $ test 12 -1
               ^
    _increment_
    $ test 12 0
              ^
Before, it would do:
    $ test 12 0
              ^
    _decrement_
    $ test 12 -1
              ^
    $ test 12 -1
               ^
    _increment_
    $ test 12 0
               ^ | 
|  | Describe why we set `$point_position` the way we do. | 
|  | If we change between negative and positive numbers, point moves:
    $ test 12 0
               ^
    _decrement_
    $ test 12 -1
               ^
I think point should instead be
    $ test 12 -1
                ^
Not sure that we should be moving point when changing from negative to
positive, though. | 
|  | This works!
Also, a while ago, I changed the Perl program to not use hyphenated
command line arguments and quoted variable names `${"increment-by"}`
because this seemed to be causing unexpected issues. | 
|  | When the negative number is the last of two numbers, the first number
would be incremented or decremented instead of the second one. Fix this
by:
* Removing the `\b` word boundaries in the search pattern. This caused
  the match start position to not include the hyphen that designates a
  negative number (instead starting at one after the hyphen).
* Setting `$start_position` to the start position of the current match
  (`$-[0]`) on every match loop iteration. This ensures the start
  position is set to an appropriate index when the number we want to
  increment is the last one in the line. Since the condition in the loop
  depends on there being a previous match position, it wouldn't set the
  start position correctly in all cases for the last number in the line.
* Remove the special case to handle the last number in the line when
  searching backward with the cursor in the last position. That case is
  now handled directly in the loop by always setting `$start_position`. | 
|  | The previous negative integer tests worked, but it turns out that when
the negative integer isn't the first one, there's a problem. | 
|  |  | 
|  |  | 
|  | Include "-" in the pattern that matches numbers. Wrap the pattern in
word boundaries also. This passes the test I added previously to
increment a negative number. | 
|  | Our pattern matcher doesn't increment or decrement negative numbers
because it doesn't look for a "-" prefix. | 
|  |  | 
|  | Copy-pasted the `incdec` subroutine from `incdec.pm` into the Bash
function. Eventually I'll have a Make rule for this.
Add some new Perl code to the `perl -e` call that calls the `incdec()`
subroutine with arguments from the shell environment. Set the current
Readline line to the result of `incdec()` to increment a number.
I was getting an error "bash_execute_unix_command: cannot find keymap
for command" when I tried to assign the binding to "\C-xa". Not sure
what's going on there but assigned it to a different one in the
meantime. | 
|  |  |