<feed xmlns='http://www.w3.org/2005/Atom'>
<title>readline-incdec/incdec.bash, branch v0.0.2</title>
<subtitle>Readline bindings to increment and decrement numbers on the command line</subtitle>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/readline-incdec/'/>
<entry>
<title>incdec.pm: Remove single quotes for Bash inclusion</title>
<updated>2022-05-26T15:03:27+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2022-05-26T15:03:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/readline-incdec/commit/?id=e3496478575027810844994990fbc789f4387939'/>
<id>e3496478575027810844994990fbc789f4387939</id>
<content type='text'>
The single quotes caused a syntax error in the Bash script when included
because the Perl script is included in a Bash single-quoted string.

Remove the single quotes to fix the Bash inclusion.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The single quotes caused a syntax error in the Bash script when included
because the Perl script is included in a Bash single-quoted string.

Remove the single quotes to fix the Bash inclusion.
</pre>
</div>
</content>
</entry>
<entry>
<title>Increase version v0.0.1 -&gt; v0.0.2</title>
<updated>2022-05-26T14:56:42+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2022-05-26T14:56:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/readline-incdec/commit/?id=9aadce83d2318ba8e161cd4b8a7664f657df0915'/>
<id>9aadce83d2318ba8e161cd4b8a7664f657df0915</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Update copyright year</title>
<updated>2022-05-26T14:55:23+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2022-05-26T14:52:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/readline-incdec/commit/?id=1cb9ad7286b87c348861dafd112a73901e4d6358'/>
<id>1cb9ad7286b87c348861dafd112a73901e4d6358</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>incdec.bash: Recompile with latest changes</title>
<updated>2022-05-26T14:50:43+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2022-05-26T14:50:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/readline-incdec/commit/?id=48356a6720b735f86f930e7a41c7b0f297042a51'/>
<id>48356a6720b735f86f930e7a41c7b0f297042a51</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>incdec.bash: Remove start position debug prints and TODO</title>
<updated>2021-08-28T22:51:44+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2021-08-28T22:51:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/readline-incdec/commit/?id=685d35ca5ea0a976c670cd533533b03a68951c2d'/>
<id>685d35ca5ea0a976c670cd533533b03a68951c2d</id>
<content type='text'>
This works now.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This works now.
</pre>
</div>
</content>
</entry>
<entry>
<title>incdec.pm: Clean up code from previous start position commit</title>
<updated>2021-08-28T22:48:35+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2021-08-28T22:45:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/readline-incdec/commit/?id=40289847cae91a317a660d38ec4c6a48164f58f6'/>
<id>40289847cae91a317a660d38ec4c6a48164f58f6</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>incdec.pm: Always return start position when backwards is on</title>
<updated>2021-08-28T22:47:56+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2021-08-28T22:28:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/readline-incdec/commit/?id=e56b8c2e88c8c5444f66634dbe3c511a5f37a3d6'/>
<id>e56b8c2e88c8c5444f66634dbe3c511a5f37a3d6</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>incdec.bash: Set up point moving after start position</title>
<updated>2021-08-28T20:07:19+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2021-08-28T20:07:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/readline-incdec/commit/?id=c8fa19d038ed79c640c5164735179611e95520d6'/>
<id>c8fa19d038ed79c640c5164735179611e95520d6</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>incdec.pm: Return both line and start position</title>
<updated>2021-08-28T17:42:31+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2021-08-28T17:42:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/readline-incdec/commit/?id=729cdbe8c41598aaa70c7c71d708953dd72a6866'/>
<id>729cdbe8c41598aaa70c7c71d708953dd72a6866</id>
<content type='text'>
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()`.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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()`.
</pre>
</div>
</content>
</entry>
<entry>
<title>incdec.pm: Fix an issue where first number wasn't incremented backwards</title>
<updated>2021-08-28T16:25:23+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2021-08-28T16:08:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/readline-incdec/commit/?id=88cc7f664a2c582c4fb08a4c3f927da7863ce9fc'/>
<id>88cc7f664a2c582c4fb08a4c3f927da7863ce9fc</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
</feed>
