Skip to content
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

Merged
merged 4 commits into from Jul 29, 2014
Merged

Fix issue #330 #333

merged 4 commits into from Jul 29, 2014

Conversation

living180
Copy link
Contributor

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.

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>
davvid added a commit that referenced this pull request Jul 29, 2014
widgets.diff: improve stage and revert actions

Closes #330

Signed-off-by: David Aguilar <davvid@gmail.com>
@davvid davvid merged commit 7453a53 into git-cola:master Jul 29, 2014
@living180 living180 deleted the issue_330 branch July 29, 2014 02:56
@living180
Copy link
Contributor Author

One thing I forgot to mention on this PR - it removed some translatable strings ('Process Diff Hunk' and 'Process Selection'). I don't know if anything needs to be done to update the .po files or not.

@davvid
Copy link
Member

davvid commented Jul 29, 2014

I think python setup.py build_pot handles it, but it may turn unused strings into comments. @Vdragon @lobocode @samsulmaarif do you have any preferences on how to deal with removals? Would you prefer that we removed unused strings from the .po files, or that we leave them as comments?

@Vdragon
Copy link
Contributor

Vdragon commented Jul 29, 2014

@davvid
Just leave them as comments(or as-is), AFAICS some translation GUIs will take them for reference(or something they called "translation memory") and should be somewhat useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants