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:
authorMike Krüger <mikkrg@microsoft.com>2019-06-05 11:37:52 +0300
committerMike Krüger <mikkrg@microsoft.com>2019-06-05 11:37:52 +0300
commit224dea46c08a39204568c96c8217c2821a4eb69b (patch)
tree92fd79625e7e34344f62e104a2bd68dad6f13318 /main/src/addins
parent794d45c338a9372744c70849e5f7081100929b64 (diff)
Fixes VSTS Bug 901463: Copy and paste is broken or copies wrong text
in "Changes" window Bug 901463: Copy and paste is broken or copies wrong text in "Changes" window DiffView was still using the old SharpDevelop clipboard command system for cut/copy/paste. Moved to monodevelop command handlers.
Diffstat (limited to 'main/src/addins')
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffView.cs72
1 files changed, 30 insertions, 42 deletions
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffView.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffView.cs
index b01210d4df..5032fbd507 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffView.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffView.cs
@@ -1,4 +1,4 @@
-//
+//
// VersionControlView.cs
//
// Author:
@@ -33,6 +33,8 @@ using MonoDevelop.Ide.Gui.Documents;
using MonoDevelop.Ide;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text;
+using MonoDevelop.Components.Commands;
+using MonoDevelop.Ide.Commands;
namespace MonoDevelop.VersionControl.Views
{
@@ -40,7 +42,7 @@ namespace MonoDevelop.VersionControl.Views
{
}
- class DiffView : DocumentController, IDiffView, IUndoHandler, IClipboardHandler
+ class DiffView : DocumentController, IDiffView, IUndoHandler
{
DiffWidget widget;
@@ -172,7 +174,8 @@ namespace MonoDevelop.VersionControl.Views
#endregion
#region IClipboardHandler implementation
- void IClipboardHandler.Cut ()
+ [CommandHandler (EditCommands.Cut)]
+ protected void Cut ()
{
var editor = this.widget.FocusedEditor;
if (editor == null)
@@ -180,7 +183,8 @@ namespace MonoDevelop.VersionControl.Views
editor.RunAction (Mono.TextEditor.ClipboardActions.Cut);
}
- void IClipboardHandler.Copy ()
+ [CommandHandler (EditCommands.Copy)]
+ protected void Copy ()
{
var editor = this.widget.FocusedEditor;
if (editor == null)
@@ -188,7 +192,8 @@ namespace MonoDevelop.VersionControl.Views
editor.RunAction (Mono.TextEditor.ClipboardActions.Copy);
}
- void IClipboardHandler.Paste ()
+ [CommandHandler (EditCommands.Paste)]
+ protected void Paste ()
{
var editor = this.widget.FocusedEditor;
if (editor == null)
@@ -196,7 +201,8 @@ namespace MonoDevelop.VersionControl.Views
editor.RunAction (Mono.TextEditor.ClipboardActions.Paste);
}
- void IClipboardHandler.Delete ()
+ [CommandHandler (EditCommands.Delete)]
+ protected void Delete ()
{
var editor = this.widget.FocusedEditor;
if (editor == null)
@@ -208,7 +214,8 @@ namespace MonoDevelop.VersionControl.Views
}
}
- void IClipboardHandler.SelectAll ()
+ [CommandHandler (EditCommands.SelectAll)]
+ protected void SelectAll ()
{
var editor = this.widget.FocusedEditor;
if (editor == null)
@@ -216,47 +223,28 @@ namespace MonoDevelop.VersionControl.Views
editor.RunAction (Mono.TextEditor.SelectionActions.SelectAll);
}
- bool IClipboardHandler.EnableCut {
- get {
- var editor = this.widget.FocusedEditor;
- if (editor == null)
- return false;
- return editor.IsSomethingSelected && !editor.Document.IsReadOnly;
- }
- }
-
- bool IClipboardHandler.EnableCopy {
- get {
- var editor = this.widget.FocusedEditor;
- if (editor == null)
- return false;
- return editor.IsSomethingSelected;
- }
+ [CommandUpdateHandler (EditCommands.Cut)]
+ protected void OnUpdateCut (CommandInfo info)
+ {
+ var editor = this.widget.FocusedEditor;
+ info.Enabled = editor != null && editor.IsSomethingSelected && !editor.Document.IsReadOnly;
}
- bool IClipboardHandler.EnablePaste {
- get {
- var editor = this.widget.FocusedEditor;
- if (editor == null)
- return false;
- return !editor.Document.IsReadOnly;
- }
+ [CommandUpdateHandler (EditCommands.Copy)]
+ protected void OnUpdateCopy (CommandInfo info)
+ {
+ var editor = this.widget.FocusedEditor;
+ info.Enabled = editor != null && editor.IsSomethingSelected;
}
- bool IClipboardHandler.EnableDelete {
- get {
- var editor = this.widget.FocusedEditor;
- if (editor == null)
- return false;
- return !editor.Document.IsReadOnly;
- }
+ [CommandUpdateHandler (EditCommands.Paste)]
+ [CommandUpdateHandler (EditCommands.Delete)]
+ protected void OnUpdatePasteDelete (CommandInfo info)
+ {
+ var editor = this.widget.FocusedEditor;
+ info.Enabled = editor != null && !editor.Document.IsReadOnly;
}
- bool IClipboardHandler.EnableSelectAll {
- get {
- return true;
- }
- }
#endregion
}
} \ No newline at end of file