feat(jump)!: make dot-repeat jumping separate from regular jumping#2284
feat(jump)!: make dot-repeat jumping separate from regular jumping#2284echasnovski merged 1 commit intonvim-mini:backlogfrom
Conversation
|
I am not sure if the extra tests in 'works after jump in Operator-pending mode' are actually needed, as the behavior of |
echasnovski
left a comment
There was a problem hiding this comment.
Thanks for the PR!
The idea and tests overall look good! The large amount of comments is only there because it is possible to focus on little things :)
|
Also, please adjust commit message to fit the new PR title. Dot-repeat is technically not only about changes (yank can be dot-repeated under some circumstances, for example). |
Indeed. However, as I understand this PR, the title should be: "ensure dot-repeat jumping is not affected by regular jumping" |
It goes both ways. And it is also a breaking change. So updated to be "make dot-repeat jumping separate from regular jumping". |
968a78c to
ab80866
Compare
ab80866 to
db511f6
Compare
lua/mini/jump.lua
Outdated
|
|
||
| -- If dot-repeating the state needs to be restored after the jump | ||
| local state_snapshot | ||
| if MiniJump.is_expr and not (MiniJump.state.mode == 'no' and vim.fn.mode(1) == 'nov') then |
There was a problem hiding this comment.
Why extra check for the forced charwise mode is needed?
There was a problem hiding this comment.
When the operation is invoked the first time in make_expr_jump we are not dot-repeating and the state should not be restored. Otherwise, after the jump, state.mode is still 'no', as it was in make_expr_jump.
FAIL in tests/test_jump.lua | state | updates `mode`:
Failed expectation for equality
Cause: different string length
Left: "no"
Right: "nov"
Traceback:
tests/test_jump.lua:185
There was a problem hiding this comment.
Hmm... Still, the extra check doesn't feel like a good solution to any problem it is meant to solve.
There was a problem hiding this comment.
Apologies, I misread the question. Indeed, this is an example of doing too much...
Changed into: local needs_restore = MiniJump._is_expr and MiniJump.state.mode ~= 'no'
There was a problem hiding this comment.
So it is to differentiate initial application of expression mapping from its dot-repeat.
I still don't think that relying on checking the mode is a robust solution. Couldn't immediately find the failing example, though.
There is a more direct approach to distinguish first and second+ calls of expression mapping output: set another flag (like _expr_map_init) in the expression mapping RHS. Then the dot-repeat is MiniJump._expr_map and not MiniJump._expr_map_init.
As it already feels like a nit picking, I'll merge into a temporary branch and adjust myself.
There was a problem hiding this comment.
Yes...)
I did think about that extra flag. That's also an extra something to reset though... Anyways, no nitpicking. Your feedback is very valuable as always and I look forward to seeing the final version
|
I pushed the new commit |
db511f6 to
75904bd
Compare
75904bd to
ee59e3a
Compare
|
Strange, some of my review comments end up as 'pending'. About the question regarding forced charwise mode:
Apologies, I misread the question. Indeed, this is an example of doing too much...
|
|
Thanks again for the PR! I've merged into a temporary branch to polish a bit and then merge into |
|
The work from this PR should now be part of the latest Couple of notes:
|
Resolve #2054