Skip to content
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

FR: Improve "diff" visibility by adding marker before line number #5140

Open
yerlaser opened this issue Dec 19, 2024 · 5 comments
Open

FR: Improve "diff" visibility by adding marker before line number #5140

yerlaser opened this issue Dec 19, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@yerlaser
Copy link

Is your feature request related to a problem? Please describe.
The current diff is mostly good, however, when there are small additions on a line those changes are hard to spot.
This happens because unlike red color green color doesn't standout.

Describe the solution you'd like
Add a marker on the lines that contain changes at the very beginning of the line, i.e. before line number.

Describe alternatives you've considered
An alternative would be to highlight the whole line with a background, however, I believe it might not be supported on all terminals

Additional context
I am aware of the existence of --git switch that with an external pager.
However, the default diff seems to be good enough except for this issue and I'd avoid using external tools whenever possible.

@yuja
Copy link
Contributor

yuja commented Dec 19, 2024

Just fyi, you could set diff.color-words.max-inline-alternation=0 to print any changed lines as separate removed/added lines.
https://jj-vcs.github.io/jj/latest/config/#color-words-diff-options

@yuja yuja added the enhancement New feature or request label Dec 19, 2024
@yerlaser
Copy link
Author

Just fyi, you could set diff.color-words.max-inline-alternation=0 to print any changed lines as separate removed/added lines. https://jj-vcs.github.io/jj/latest/config/#color-words-diff-options

Thanks. That suggestion improves the detectability of changes, but at the same time makes it harder to compare them once detected.
The inline word diff is very good at understanding what changed, but when the changes are small the line containing them gets harder to detect.
So, marks on changed lines that standout, e.g. highlight or an asterisk before line number (or both) would be perfect.

@yuja
Copy link
Contributor

yuja commented Dec 19, 2024

marks on changed lines that standout, e.g. highlight or an asterisk before line number (or both) would be perfect.

or make context line numbers dimmed.

Naming aside, maybe we can add "context"/"changed" label to line numbers (or to the whole line.) That's the easiest fix.

@yerlaser
Copy link
Author

marks on changed lines that standout, e.g. highlight or an asterisk before line number (or both) would be perfect.

or make context line numbers dimmed.

Naming aside, maybe we can add "context"/"changed" label to line numbers (or to the whole line.) That's the easiest fix.

Now that you suggested it, I think dimming the context line numbers would be the best option of all.
Because, currently, they pop out unnecessarily.
However, given that people might be using tmux or similary software which don't support all color options adding text would be a good fallback mechanism.

@yuja
Copy link
Contributor

yuja commented Dec 19, 2024

The default might have to be underline/bold changed line numbers for compatibility reason, but user can set whatever color/style if line numbers and contents are labeled as "context"/"changed".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants