sourcegit-scm / sourcegit

Windows/macOS/Linux GUI client for GIT users
MIT License
981 stars 100 forks source link

Easier single line staging (allow empty line staging) #360

Open NilsPvR opened 4 weeks ago

NilsPvR commented 4 weeks ago

For me and @julius-boettger the single line staging feature is a dealbreaker feature for a Git GUI. I really like the newly (I think in v.8.25 ) updated/added UX for staging git hunks and single line staging. The hover effect allows me to not have to right-click when staging single lines.

grafik

By selecting the line I can also stage a single or multiple specific lines.

The actual issue

I would like to be able to stage empty lines without staging surrounding lines. However with the current UI I can't "select" an empty line 😅 I'll end up having to stage the line above or below aswell: grafik

Maybe a feature where you could click on the line number to stage it would be nice. Or similar to Github where when you hover the line a + icon is added: grafik I could also imagine the line number changing into a + icon but this might be annoying for some users? 🤷‍♂️

love-linger commented 4 weeks ago

the simplest way to solve this problem is append an space character for empty lines. but i am not sure this is be best solution.

[!NOTE] in this way, the space character appended to the empty line will not affect the patch result, it is only used in UI.

NilsPvR commented 3 weeks ago

Hey, sorry for the late reply. If I add the space in my editor or IDE the space will be commited. On the "Changes" view I can't edit anything, so I am not sure how I would add the space where it would only take effect in the UI. Also if I am honest that does sound more like a workaround 😅. But would obviously be better than nothing.

love-linger commented 3 weeks ago

Hey, sorry for the late reply. If I add the space in my editor or IDE the space will be commited. On the "Changes" view I can't edit anything, so I am not sure how I would add the space where it would only take effect in the UI. Also if I am honest that does sound more like a workaround 😅. But would obviously be better than nothing.

You misunderstood what I meant. It is not the operation that the user needed to do, but when displying text diff with empty line the text editor appends an extra space to help user selecting this line. I am still thinking about how to implement this feature.

NilsPvR commented 3 weeks ago

You misunderstood what I meant. It is not the operation that the user needed to do, but when displying text diff with empty line the text editor appends an extra space to help user selecting this line. I am still thinking about how to implement this feature.

Alright, yee I misunderstood that. Could be a bit confusing on why there is a space in the UI which is not actually there.