sourcegit icon indicating copy to clipboard operation
sourcegit copied to clipboard

Easier single line staging (allow empty line staging)

Open NilsPvR opened this issue 1 year ago • 4 comments

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? 🤷‍♂️

NilsPvR avatar Aug 15 '24 14:08 NilsPvR

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.

love-linger avatar Aug 16 '24 07:08 love-linger

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.

NilsPvR avatar Aug 19 '24 07:08 NilsPvR

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.

love-linger avatar Aug 19 '24 08:08 love-linger

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.

NilsPvR avatar Aug 19 '24 09:08 NilsPvR

I've no idea about how to implement this properly. And after checking anthor well-known git client Fork, it does not supports stage/unstage a single empty line surrounded with other changes too.

Therefore, I decide not to go any further into this issue.

love-linger avatar Sep 23 '24 03:09 love-linger