Skip to content

fix(jump): jump sometimes highlights after jumping has stopped#2319

Open
abeldekat wants to merge 1 commit intonvim-mini:mainfrom
abeldekat:jump_fix_bufleave_highlighting
Open

fix(jump): jump sometimes highlights after jumping has stopped#2319
abeldekat wants to merge 1 commit intonvim-mini:mainfrom
abeldekat:jump_fix_bufleave_highlighting

Conversation

@abeldekat
Copy link
Member

Details:

  • As a side-effect of the jump, a function is scheduled that will trigger a BufLeave event

  • After the jump, a function is scheduled immediately that will run H.highlight(0 delay.highlight)

On BufLeave, MiniJump.stop_jumping is called.
That will stop H.timers.highlight. However, the timer already scheduled the function.
Thus, H.highlight runs and applies the highlighting, although state.jumping is false.

This PR adds an extra early return to H.highlight

Resolve #2318

Details:

- As a side-effect of the jump, a function is scheduled that will
trigger a `BufLeave` event

- After the jump, a function is scheduled immediately that will run
`H.highlight`(0 delay.highlight)

On `BufLeave`, `MiniJump.stop_jumping` is called.
That will stop `H.timers.highlight`. However, the timer already
scheduled the function.
Thus, `H.highlight` runs and applies the highlighting, although
`state.jumping` is false.

This PR adds an extra early return to `H.highlight`

Resolve nvim-mini#2318
@echasnovski
Copy link
Member

Thanks for the issue!

  • As a side-effect of the jump, a function is scheduled that will trigger a BufLeave event

If that is the 'mini.files' behavior (which from 2318 it probably is), then it should be fixed on 'mini.files' side. That should not happen.

But even with the change from this PR I still don't have "smart jumping" work in 'mini.files'. Which is strange and needs extra attention.

@abeldekat
Copy link
Member Author

Thanks for the issue!

  • As a side-effect of the jump, a function is scheduled that will trigger a BufLeave event

If that is the 'mini.files' behavior (which from 2318 it probably is), then it should be fixed on 'mini.files' side. That should not happen.

But even with the change from this PR I still don't have "smart jumping" work in 'mini.files'. Which is strange and needs extra attention.

Yes it is, on CursorMoved. This PR does not repair smart jumping, it merely prevents the suggestion that it's possible(by highlighting) when it is not.

The problem is the file preview. On each change, MiniFiles emits BufLeave. That prevents smart jumping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Jump sometimes highlights after jumping has been stopped

2 participants