sourcegit-scm / sourcegit

Windows/macOS/Linux GUI client for GIT users
MIT License
1.4k stars 140 forks source link

['Changes' window] Add shortcut to the right click menu to allow staging specific lines #718

Open albertodlc opened 1 day ago

albertodlc commented 1 day ago

I like the implementation of staging with individual blocks. But I think it is also useful to have an option to stage specific lines. For example, including a new option on right click menu (the menu is currently implemented with the 'copy' option):

  1. Select the line
  2. Right click > Stage Selected Line image
goran-w commented 1 day ago

That's already possible. If you select lines and hover with mouse pointer, then the Stage/Discard buttons will be working on just the selected text, see these screenshots of unselected vs. selected text :

Without selection: image

With selection: image

albertodlc commented 1 day ago

I didn't notice, it looked like it was the same block selection... I think it is a bit confusing using the same name for the block and mouse selection.

Either way, I think the proposed shortcut is a good idea, I have an Ultrawide monitor and when the line is selected it's difficult to stage the implemented way: image

If the line selection logic is currently implemented, it shouldn't be difficult to add the action to the right click menu

love-linger commented 13 hours ago

I didn't notice, it looked like it was the same block selection... I think it is a bit confusing using the same name for the block and mouse selection.

Why use different names for the same operations? The stage/unstage/discard range is already hightlighted both in text view and the line number margins. image

Either way, I think the proposed shortcut is a good idea, I have an Ultrawide monitor and when the line is selected it's difficult to stage the implemented way:

I've added the hotkeys to stage/unstage/discard changes in text diff view. You can download the latest CI build from Github Actions. image image