Handle range-diff commit header lines in s:cfile()#2353
Open
zivarah wants to merge 1 commit intotpope:masterfrom
Open
Handle range-diff commit header lines in s:cfile()#2353zivarah wants to merge 1 commit intotpope:masterfrom
s:cfile()#2353zivarah wants to merge 1 commit intotpope:masterfrom
Conversation
While `range-diff` output doesn't display with any syntax highlighting,
it's still in a buffer with a filetype of 'git' and thus fugitive
attaches the standard jump mappings. However, those mappings work
inconsistently for `range-diff` output due to some accidental matching
in `s:cfile()`. For lines like these:
1: aaaaaaa = 1: bbbbbbb My subject
2: aaaaaaa = -: ------- My other subject
Depending on the position of the cursor, we sometimes hit the `<cword>`
fallback and open the commit. This can happen when the cursor is over a
commit hash, or even on one of the `:`. However, for a line like this:
-: ------- > 2: aaaaaaa My subject
We end up hitting the block intended to catch +/- lines in diff output,
and fail to identify a commit.
Add a special set of handling for range-diff header lines. In cases
where only one commit is present in the line, open that commit
automatically regardless of cursor position. For cases where the line
represents a different commit on each side, fall back to a `<cword>`
approach to allow opening either commit based on cursor position.
747781c to
0b38789
Compare
Author
|
@tpope I wanted to check in on this since it's been a month since I opened it. Let me know if there's anything you'd like to see changed (or if you're concerned about supporting range-diff for some reason). Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
While
range-diffoutput doesn't display with any syntax highlighting, it's still in a buffer with a filetype of 'git' and thus fugitive attaches the standard jump mappings. However, those mappings work inconsistently forrange-diffoutput due to some accidental matching ins:cfile(). For lines like these:Depending on the position of the cursor, we sometimes hit the
<cword>fallback and open the commit. This can happen when the cursor is over a commit hash, or even on one of the:. However, for a line like this:We end up hitting the block intended to catch +/- lines in diff output, and fail to identify a commit.
Add a special set of handling for range-diff header lines. In cases where only one commit is present in the line, open that commit automatically regardless of cursor position. For cases where the line represents a different commit on each side, fall back to a
<cword>approach to allow opening either commit based on cursor position.