Tue 24 Jan 2017 10:20:05 AM UTC, original submission:
To reproduce, run 'echo xxx >exes' and then 'nano --ignore exes'. Then type: M-R xx <Enter> xxx <Enter>. Then type Y for every prompt. Nano asks /three/ times: first for the final two xx, then for the first two, and then again for the final two. Wrong. And after the three replacements, the cursor sits at the /end/ of the line, instead of at the beginning. Wrong too.
One might expect nano to ask only once: for the first two, and that should be it. But since nano will not start replacing right where the cursor is but one step beyond, it would be defensible that nano asked twice: for the final two, and then, wrapping around, for the first two. But that should then really be it, because the cursor has reached the starting point.
This bug is old too, since at least nano-2.0.2.
In current git, the behavior is even worse, although somehow more understandable: it does /four/ replacements.
For comparison: doing the replacements backwards:
M-R M-B xx <Enter> xxx <Enter>
will do just two replacements, in all released versions of nano. In current git it will "hang": it will do infinite replacements, because it never seems to move the cursor from where it found the first match.
|