fork-dev / Tracker

Bug and issue tracker for Fork for Mac
498 stars 12 forks source link

[Enhancement] Allow staging/discarding lines on both sides of a split diff at once #1985

Open ian-h-chamberlain opened 9 months ago

ian-h-chamberlain commented 9 months ago

Hi, thanks for making Fork, I use it every day and love it a lot! One feature I really like is the ability to stage / discard one hunk at a time in the side-by-side diff of "Local Changes":

Screenshot 2023-10-13 at 15 26 15

However, sometimes a hunk as decided by git is too big, and I'd rather stage or discard just a few lines at a time. This is possible by selecting the lines, but only on one side of the diff at a time, as best I can tell:

Screenshot 2023-10-13 at 15 26 22

This means that in cases where a single line was changed (e.g. the first line in the above example), I have to first select one side, stage it, then select the other side, then stage that. This issue is a request to enable selecting lines on both sides of the diff, and staging/discarding them together with one click (a user-defined hunk, if you prefer to think of it that way).

It seems like this is already possibly when using the unified diff view (as opposed to side-by-side), so hopefully it's just a matter of handling the mouse drag across the two columns and applying the same underlying logic afterwards?

Thanks!

DanPristupov commented 9 months ago

This issue is a request to enable selecting lines on both sides of the diff

I can't implement that, those are two separate controls.

It seems like this is already possibly when using the unified diff view

Yes, because it's a single text control.

hopefully it's just a matter of handling the mouse drag across the two columns and applying the same underlying logic afterwards?

No, it's slightly more complicated.

ian-h-chamberlain commented 9 months ago

Ah, okay, the fact that they are separate controls probably means the click-and-drag I was thinking of doesn't make sense. Maybe as an alternative it would be more feasible to allow cmd+drag or shift+drag to select parts on both sides of the diff? I'm not sure if multi-selection like that would be any easier to implement than what I was describing before, but I think it would satisfy my request as well.

Thanks for the quick response!