Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Munn <greg@sgmunn.com>2015-12-09 19:52:29 +0300
committerGreg Munn <greg@sgmunn.com>2015-12-09 19:52:29 +0300
commitbd26ad70c68c6f41e21beafdbb359e17134fb860 (patch)
treeeca954a28900ef18f74cb49517e1e4d65cd6359d
parentda2e58c0505f8951708200abd883f316da35aecd (diff)
parentec42eff8bf86b1a6a63c6b7eb1e623debb55ab49 (diff)
Merge pull request #1149 from mono/cycle6-blameMenu
[VCS] Fix Blame commands not reliably working
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameWidget.cs19
1 files changed, 11 insertions, 8 deletions
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameWidget.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameWidget.cs
index 51c3dbfa41..ef94cc2166 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameWidget.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameWidget.cs
@@ -399,7 +399,7 @@ namespace MonoDevelop.VersionControl.Views
}
internal double highlightPositon;
- internal Annotation highlightAnnotation;
+ internal Annotation highlightAnnotation, menuAnnotation;
protected override bool OnMotionNotifyEvent (EventMotion evnt)
{
TooltipText = null;
@@ -438,6 +438,9 @@ namespace MonoDevelop.VersionControl.Views
protected override bool OnButtonPressEvent (EventButton evnt)
{
if (evnt.TriggersContextMenu ()) {
+ int startLine = widget.Editor.YToLine (widget.Editor.VAdjustment.Value + evnt.Y);
+ menuAnnotation = startLine > 0 && startLine <= annotations.Count ? annotations[startLine - 1] : null;
+
CommandEntrySet opset = new CommandEntrySet ();
opset.AddItem (BlameCommands.ShowDiff);
opset.AddItem (BlameCommands.ShowLog);
@@ -460,24 +463,24 @@ namespace MonoDevelop.VersionControl.Views
[CommandHandler (BlameCommands.CopyRevision)]
protected void OnCopyRevision ()
{
- if (highlightAnnotation == null)
+ if (menuAnnotation == null)
return;
var clipboard = Clipboard.Get (Gdk.Atom.Intern ("CLIPBOARD", false));
- clipboard.Text = highlightAnnotation.Revision.ToString ();
+ clipboard.Text = menuAnnotation.Revision.ToString ();
clipboard = Clipboard.Get (Gdk.Atom.Intern ("PRIMARY", false));
- clipboard.Text = highlightAnnotation.Revision.ToString ();
+ clipboard.Text = menuAnnotation.Revision.ToString ();
}
[CommandHandler (BlameCommands.ShowDiff)]
protected void OnShowDiff ()
{
- if (highlightAnnotation == null)
+ if (menuAnnotation == null)
return;
foreach (var view in widget.info.Document.ParentDocument.Views) {
DiffView diffView = view.GetContent<DiffView> ();
if (diffView != null) {
view.Select ();
- var rev = widget.info.History.FirstOrDefault (h => h.ToString () == highlightAnnotation.Revision);
+ var rev = widget.info.History.FirstOrDefault (h => h.ToString () == menuAnnotation.Revision);
if (rev == null)
return;
diffView.ComparisonWidget.SetRevision (diffView.ComparisonWidget.DiffEditor, rev.GetPrevious ());
@@ -490,13 +493,13 @@ namespace MonoDevelop.VersionControl.Views
[CommandHandler (BlameCommands.ShowLog)]
protected void OnShowLog ()
{
- if (highlightAnnotation == null)
+ if (menuAnnotation == null)
return;
foreach (var view in widget.info.Document.ParentDocument.Views) {
LogView logView = view.GetContent<LogView> ();
if (logView != null) {
view.Select ();
- var rev = widget.info.History.FirstOrDefault (h => h.ToString () == highlightAnnotation.Revision);
+ var rev = widget.info.History.FirstOrDefault (h => h.ToString () == menuAnnotation.Revision);
if (rev == null)
return;
logView.LogWidget.SelectedRevision = rev;