fix: do not change the jumplist when using to a line in a file #2910
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
While using some Telescope commands that jump directly to a line in a file (like
tags
), the function first opens the file, then callnorm! gg
and search for the target line.This will include the top of the file in the jumplist.
Since the top of the file is not jumped-to by user, it's not a position that the user cares about; it would make sense to not include this position in the jumplist.
Reproduce the bug
To see this behaviour, open a file, call the
Telescope tags
command, select and confirm any tag that is in the middle of a big file (i.e. when the target tag is jumped-to, the top of the file (line 1) should ideally not be visible), then pressCtrl-O
to go back in the first file you edited just before theTelescope tags
invocation.This will not set you back in the first file, but at the top of the file containing the target tag.
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
I've used this patch for a while in my normal workflow, to ensure no obvious problems arise.
Configuration
NVIM v0.9.5
AppImage
Debian 12