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

🚀 Improve line number to make UI more like github #247

Open
kevinhwang91 opened this issue Jul 12, 2020 · 9 comments
Open

🚀 Improve line number to make UI more like github #247

kevinhwang91 opened this issue Jul 12, 2020 · 9 comments

Comments

@kevinhwang91
Copy link

left side is github, right side is delta:
image

Here is my config about delta:

export GIT_PAGER="delta -n --syntax-theme=TwoDark -w 1 \
    --hunk-header-style='syntax bold' \
    --hunk-header-decoration-style='black box' \
    --file-style='yellow italic' \
    --file-decoration-style='yellow ul' \
    --minus-style='syntax #450a15' \
    --minus-emph-style='syntax #600818' \
    --plus-style='syntax #0b4820' \
    --plus-emph-style='syntax #175c2e' \
    --line-numbers-zero-style='#4b5263' \
    --line-numbers-minus-style='syntax #600818' \
    --line-numbers-plus-style='syntax #0b4820' \
    --line-numbers-left-format='{nm:^4} ' --line-numbers-right-format='{np:^4}  '"

From the above image, UI of delta about line number is so weird.

@dandavison
Copy link
Owner

Hi @kevinhwang91, yes you're right, the background colors aren't making much sense currently :/ Thanks for this! I'll have another think about this and modify the behavior (without changing the interface hopefully) so that the background colors form contiguous blocks in this situation.

@bew
Copy link

bew commented Nov 24, 2022

Hello, I'd be interested in this as well!
How is your thinking on how to do this?
(I'd like to try to make a PR if you think it's good as a first contribution)

@dandavison
Copy link
Owner

dandavison commented Nov 25, 2022

Hi @bew I'd be happy for someone to make this possible. I don't have time to look into it currently unfortunately. IIRC the current configuration interface doesn't quite make this possible. I would suggest:

  • Step 1: Play around with the various line-numbers-*-style options to convince yourself that it is/isn't possible today.

  • Step 2: Identify a way of making it possible, ideally without changing the meaning of current options, so that other user's configs are not broken. Alternatively, perhaps you identify some change to the options that does change the meaning, and you present an argument that other users are likely to like the new meaning more than the old!

@danwilliams
Copy link

I stumbled upon this problem today 🙂 I notice this issue is quite old - has anyone done any work on it? (@dandavison @bew) If not, I'll see if I can find some time to fix it.

@bew
Copy link

bew commented Nov 5, 2023

@dandavison go for it, I got caught up with other configs and never went back to it (although I was thinking about it yesterday for some reason 🤷‍♂️)

@dandavison
Copy link
Owner

@danwilliams yes go for it, I haven't been able to get to it. Could be helpful to post a design proposal (i.e. any modified meanings of existing options plus any new options) before doing too much implementation. Bear in mind that it needs to all make sense with and without side-by-side mode active, and that the configuration options are already quite complex.

@danwilliams
Copy link

Okay, cool 👍

danwilliams added a commit to danwilliams/delta that referenced this issue Nov 5, 2023
Fixed the painting of line numbers so that instead of each column or
side always keeping the same colour, which looks odd, it instead uses
the colour appropriate to the line's status.

In other words, if there has been a line removed, instead of showing
the left (minus) column/side as minus style and the right (plus)
column/side as plus style, both will be shown as minus style.
@danwilliams
Copy link

@dandavison @bew it turned out to be extremely simple - once I'd identified how the code worked, which only took a few minutes due to it being very well structured, the change was simple and obvious.

@dandavison the tests are a little odd - they work but the feedback does not make it overly clear exactly which bit is failing. So that took longer to grok than the code fix 😄

I have added some screenshots to the PR - it seems much better now and behaves as I would expect. However, please beware that I've only tested the things I am aware of that are relevant and affected by this change. In particular I don't think any documentation updates are necessary, as I see this as a bugfix more than anything, but if you disagree then please direct me to whichever area of documentation you feel might need to have something written about this 🙂

@danwilliams
Copy link

@kevinhwang91 @bew I'm curious if my PR fixes the behaviour in your opinions? 🙂

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

No branches or pull requests

4 participants