Lazygit: Make highlighted line more distinguishable

Created on 22 Oct 2019  路  18Comments  路  Source: jesseduffield/lazygit

Describe the bug

When staging a file line by line, it is really hard to keep track of where in the file your are. The highlighted line doesn't stand out.

To Reproduce

Steps to reproduce the behavior:

  1. Go to stage line/hunks
  2. Scroll down to see the selected line

Expected behavior

Maybe a bigger font or just some background color.

Screenshots

issue

Desktop (please complete the following information):

  • OS: Linux Arch
  • Lazygit Version 0.8.2
bug

All 18 comments

I agree on this. I'm currently working on a revamp of the staging panel that gives the selected line a blue background so this issue will be covered by that feature :)

Thanks!

This is really a terminal theme issue,
But that said it would be nice if this color was changeable in the lazygit config.

I think this is not that complicated to add so if you would like to learn a bit of golang you could try fix this yourself, for a few hints i recently merged in a pr that was also colors related https://github.com/jesseduffield/lazygit/pull/519.

If you don't want to fix it i have no problem doing it myself but i need to find some time.

Woops my laptop was in standby last 14 hours, just opened it and reacted to this issue without refreshing the page sorry :)

hahaha

this has been implemented in the latest release :)

Could I ask that the color of the highlighted line be customizable? (I'd be happy to open a new issue for this):

Blue background highlighting makes the highlighted line perfectly impossible to read in my terminal with my current terminal colors. Being able to change it to another color would be great.

Thanks!!! (and thanks for a really great project :slightly_smiling_face: )

Alternatively, is there a way to customize commands in lazygit?

If I could customize the command:

func coloredString(colorAttr color.Attribute, str string, selected bool, included bool) string {
    var cl *color.Color
    attributes := []color.Attribute{colorAttr}
    if selected {
        attributes = append(attributes, color.BgBlue)
    }
    cl = color.New(attributes...)
    var clIncluded *color.Color
    if included {
        clIncluded = color.New(append(attributes, color.BgGreen)...)
    } else {
        clIncluded = color.New(attributes...)
    }

    if len(str) < 2 {
        return utils.ColoredStringDirect(str, clIncluded)
    }

    return utils.ColoredStringDirect(str[:1], clIncluded) + utils.ColoredStringDirect(str[1:], cl)
}

in a local custom file, that would do it. All I need is to replace color.BgBlue by another color (at least, I think?). But maybe this is not possible because I would have to rebuild the package after updating something like this?

Thank you!

@prosoitos I've put up a PR for this https://github.com/jesseduffield/lazygit/pull/658. Would you be able to give that a try?

It works great! :slightly_smiling_face:

Thank you so much @jesseduffield for doing this so quickly!!! :slightly_smiling_face:

no worries :)

I am starting to feel bad because I am swamping you with FRs and suggestions :worried:

But in my terminal, even in the side panels, it is pretty difficult to see the active lines. I looked at the code to see whether I would be able to come up with a PR to make the active lines with a background color instead of being turned to bold, but I can't test what I am doing locally, so it is not very easy to make sure I am not messing up a lot of things.

How would you feel about the idea of having selected lines with a different background (mimicking what is happening in the Patch panel) instead of the current behaviour in the side panels?

I am starting to feel bad because I am swamping you with FRs and suggestions 馃槦

Don't feel bad, these are all good suggestions and there would be plenty others who want them :)

Funny you mention that, I actually started working on that but decided against it because there wasn't a known use case for it. But it wouldn't be very hard to do.

Did you have specific issues testing locally? Perhaps I could give you some pointers

Don't feel bad, these are all good suggestions and there would be plenty others who want them :)

Thanks...
I usually don't swamp projects with issues this way. But lazygit is so very cool that I am really excited to have the few things I find missing in it added so that I can really use it all the time.

Did you have specific issues testing locally? Perhaps I could give you some pointers

Well, it simply is that I don't know how to build the package from source :flushed:

But if you tell me how I can build and install lazygit from my local fork, then I can test things locally and possibly submit PRs. Thanks!!

Note: I am on Arch Linux.

First step is to install golang: https://golang.org/doc/install
Then from the repo's root you should be able to run go run main.go and it should start up fine :)

Ok. Thank you for the info! Sorry for being very go-naive :slightly_smiling_face:

I will give this a try.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

letarg0 picture letarg0  路  4Comments

JoeKlemmer picture JoeKlemmer  路  3Comments

cbeley picture cbeley  路  6Comments

lordlycastle picture lordlycastle  路  5Comments

mxmerz picture mxmerz  路  6Comments