| Age | Commit message (Collapse) | Author |
|
|
|
|
|
This passes the two leading zero tests, but fails the test that tries to
increment a single-digit "0" at the last position in the string.
Also fix the test's expected start position.
|
|
|
|
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.
|
|
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.
|
|
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.
|
|
|
|
The previous negative integer tests worked, but it turns out that when
the negative integer isn't the first one, there's a problem.
|
|
|
|
Our pattern matcher doesn't increment or decrement negative numbers
because it doesn't look for a "-" prefix.
|
|
|
|
A new subrouting argument that defines by how much the number should be
incremented, or decremented if a negative step value is given.
Add a few new tests to verify the decrementing behaviour. The final test
where point is in the middle of the number fails.
|
|
|
|
Set up the proper condition to get the start index of the number just
before point.
|
|
|
|
Doesn't work for middle numbers yet.
|
|
We were previously using values specific to the first and second numbers
in the line. Get middle-of-number point handling working for the third
number in the line, and hopefully the rest as well.
|
|
Test fails. Increments the second number instead of the third.
|
|
Currently, the 'cursor within number' handling only works when the
cursor is inside the first number. It needs to work for any number in
the line.
|
|
Add a failing test for incrementing a number when the cursor is at:
test 19 0
^
This currently results in:
test 110 0
which is incorrect.
|
|
Substrings and direction.
|
|
This allows us to more easily test the functionality and add new
behaviours.
|