altsem / gitu

A TUI Git client inspired by Magit
MIT License
1.74k stars 89 forks source link

View diff of unstaged files? #51

Closed knubie closed 5 months ago

knubie commented 6 months ago

Hi, I just found this project on the orange site and have been playing around with it and quite like it so far. One thing I couldn't figure out, and maybe it's not been implemented yet, is how to view a diff of one of the unstaged (or staged, or untracked) files.

altsem commented 6 months ago

Ah perhaps this isn't clear, but lines ending with an ellipsis (...) are collapsed sections. You can expand them by pressing tab.

Untracked files don't show anything, but you can still open them in your editor by pressing enter

knubie commented 5 months ago

Aha, got it, thanks! Just and idea, but maybe an arrow on the left hand side of the line might be a good indicator as well?

altsem commented 5 months ago

Think that may be a good idea!

altsem commented 5 months ago

@knubie I messed around a bit and think I found something that I feel doesn't clutter the UI. Does this make more sense? image

knubie commented 5 months ago

@altsem Thank you for working on this!

This is just my 2¢ so make of it what you will, but I think those kinds of collapsible icons are usually at the beginning of the line (on the left side in this case), like this:

This is a collapsible section And here is more content that can be toggled.

I think the ellipsis probably makes more sense as an end-of-line identifier, as that is often used in code editors and IDEs to show folded code.

However, given that each line is a different length, the identifier (whichever one is used) will be in a different position for each line, making it difficult to tell which line is collapsed when scanning the screen. Plus, when scanning text I don't always scan to the end of the line so I might not even see the ellipsis at all.

That said, this your project so please feel free to implement whatever changes you want!

altsem commented 5 months ago

No worries! I appreciate the interest and feedback. I guess the cursor would have to change at some point to not be an arrow. Haven't decided on that either. Here's how that looked like: image

It feels a lot cleaner to only mark the collapsed sections (but does not make as much sense?): image

It's just not clear to me where to go, so I haven't changed it.

altsem commented 5 months ago

Closing this for now, I'll keep the idea in mind :)