undo with %s// replacement jump
kyx0r opened this issue · comments
Currently if one does any successful %s// replacement and then uses u to undo it, the screen always jumps to line 0 of the open file. I don't think this makes sense and is sort of annoying. What it should do instead is jump to the first change that has been done by %s// in lbuf and of course undo the result, OR it should just stay in the same place, no jump. @aligrudi
The easiest solution maybe to just write the current postion into * jump register right after the substitute command.
I fixed it in my fork, here are the changes if it was hard to understand initially.
kyx0r/nextvi@0c7b420
Thank you Ali. In case you did not notice, my commit on the fork had a typo where it should of been xrows, not xcols. I have fixed it next commit. I prefer the undo-redo to stay in place if the affected area is bigger than terminal rows, but that's just what I am doing, kinda settling on a middle ground between 2 possible solutions.