71/dance

selections.restore.withCurrent reverse=true doesn't work how it should

Opened this issue · 0 comments

OS: NixOS 24.05
VSCode: VSCodium 1.91.1
Dance Version: 0.5.15001

It seems that selections.restore.withCurrent reverse=true doesn't work. Behaviour of <a-Z> is the same as of <a-z>, while in Kakoune it is different: <a-Z> executes the combine operator on current selections and register selections and stores the result back to register without ever changing current selections. I find this command very useful for interactive selection editing, hence this bug is slightly annoying.

Looking at the sourcecode of the implementation it seems that reverse flag just swaps the selection arrays on which combine operations work - but all the operations are symmetric! union, intersection, longest/shortest, leftmost/rightmost - all of them don't care: f(a,b) = f(b,a)!

It is possible to emulate the desired behaviour using custom registers, but it would be nice to have proper implementation by default.