-
Notifications
You must be signed in to change notification settings - Fork 405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move line number into hunk header #473
Conversation
e94327e
to
f680b51
Compare
Awesome, thank you!!! I can now enable this: And with iTerm2's semantic history logic, hovering over the file:line allows me to click and go directly to the location in the file: https://iterm2.com/documentation-preferences-profiles-advanced.html Enabling hyperlinks in delta seems to confuse iTerm: Either way, I would recommend hyperlinking both the file and line number as one item, as you can use One additional feature that I'm not sure is possible, is to (optionally) offset the line number with the number of context lines. Eg., if I pass I'd like the line number to refer to line 14, so I can jump directly to the affected code, but still show context lines in the diff. |
Hey @torarnv, thanks for the
Hm, this should work. I would ask if your less version supports hyperlinks, but you've already been involved in gwsw/less#54! Are you using tmux? That also needs a patch applying in order for it to support hyperlinks (e.g. dandavison/tmux@31ae4ab). |
You're right, I hadn't upgraded my Works fine with less v570+ ( As suggested earlier I think it would make sense to make the |
Great. I agree, I'll make the whole thing the hyperlink. It might be slightly ugly with the way iterm2 currently renders them but I still agree it's the right thing to do. |
@torarnv I've hyperlinked the entire There's one issue with the hyperlink: when the file path has a color, the hyperlink rendering terminates at the end of the file and does not extend to the line number. I'm just going to dump these examples here. I haven't looked into this properly yet and don't know whether it's a bug in my ANSI codes, or a bug in iTerm2, or it's not supported by the spec, etc.
|
Thanks!!
Hmm, hard to say. I'd keep it as is for now, and file an issue with iTerm2 to see what they say. |
@dandavison [delta]
line-numbers = true
hunk-header-style = file line-number syntax can't display header's line number when |
Thanks @kevinhwang91. That was stupid of me to leave that inconsistency in! Fixed in master at a499d46. Yes, the first line number will then be present in two places, but as @torarnv has mentioned, the |
Move line number into hunk header cc @ulwlu @torarnv
This PR gets rid of the isolated line number and moves it into the hunk header. This is similar to @torarnv's #309 (comment).
By default the new hunk header will look like this (that's
hunk-header-style = line-number syntax
)The file path can be included with
hunk-header-style = file line-number syntax
:or just the file path and no line number
hunk-header-style = file syntax
hyperlinks
still functions as before, converting the line number into a hyperlink. We may want to consider hyperlinking the file path as well.