New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue #330 #333
Fix issue #330 #333
Conversation
This new method is a cheaper alternative to DiffEditor.offset_and_selection() if the actual content of the selection is not needed. Signed-off-by: Daniel Harding <dharding@living180.net>
Pull a repeated check for s.modified up into the parent if statement. Signed-off-by: Daniel Harding <dharding@living180.net>
In the DiffEditor.offset_and_selection() method, use cursor.selectionStart() instead of cursor.position() because cursor.position() can be at either end of the selection. Signed-off-by: Daniel Harding <dharding@living180.net>
Previously the Stage, Unstage, and Revert commands each had two variants, e.g. "Stage Diff Hunk" and "Stage Selected Lines". The "Diff Hunk" variant would act upon the hunk underneath the cursor if there was no selection, or on all hunks falling within the selection if there was a selection. The "Selected Lines" variant was only enabled if there was a selection and would operate on the lines falling within the selection. It was decided to simplify things and combine the two variants into a single command that adapts to the context. Returning to the "Stage" case, the command stages the hunk under the cursor if there is no selection, and stages the selected lines if there is a selection. This was actually implemented by making a single context-sensitive action for the Stage/Unstage case, and another action for the Revert case. The action text (and icon, for the Stage/Unstage action) is set dynamically when creating the context menu. Closes git-cola#330 Suggested-by: Uri Okrent <uokrent@gmail.com> Helped-by: David Aguilar <davvid@gmail.com> Signed-off-by: Daniel Harding <dharding@living180.net>
widgets.diff: improve stage and revert actions Closes #330 Signed-off-by: David Aguilar <davvid@gmail.com>
One thing I forgot to mention on this PR - it removed some translatable strings ( |
I think |
@davvid |
This PR implements the changes discussed in issue #330 by combining commands such as Stage Diff Hunks and Stage Selected Lines into a single command that behaves appropriately depending on whether or not there is a selection.