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
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SearchAndReplaceWidget.cs7
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Actions/ClipboardActions.cs8
2 files changed, 14 insertions, 1 deletions
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SearchAndReplaceWidget.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SearchAndReplaceWidget.cs
index 3bcb5c7387..9c9ef47817 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SearchAndReplaceWidget.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SearchAndReplaceWidget.cs
@@ -284,7 +284,7 @@ namespace MonoDevelop.SourceEditor
searchEntry.FilterButtonPixbuf = Xwt.Drawing.Image.FromResource ("searchoptions.png");
if (textEditor.IsSomethingSelected) {
- if (textEditor.MainSelection.MinLine == textEditor.MainSelection.MaxLine) {
+ if (textEditor.MainSelection.MinLine == textEditor.MainSelection.MaxLine || ClipboardContainsSelection()) {
SetSearchPattern ();
} else {
IsInSelectionSearchMode = true;
@@ -304,6 +304,11 @@ namespace MonoDevelop.SourceEditor
SearchAndReplaceOptions.ReplacePatternChanged += HandleReplacePatternChanged;
}
+ bool ClipboardContainsSelection ()
+ {
+ return textEditor.SelectedText == ClipboardActions.GetClipboardContent ();
+ }
+
void HandleReplacePatternChanged (object sender, EventArgs e)
{
ReplacePattern = SearchAndReplaceOptions.ReplacePattern;
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Actions/ClipboardActions.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Actions/ClipboardActions.cs
index 22bcbb245a..57f417d9df 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Actions/ClipboardActions.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Actions/ClipboardActions.cs
@@ -434,5 +434,13 @@ namespace Mono.TextEditor
return;
PasteFrom (Clipboard.Get (CopyOperation.CLIPBOARD_ATOM), data, false, data.IsSomethingSelected ? data.SelectionRange.Offset : data.Caret.Offset);
}
+
+ public static string GetClipboardContent()
+ {
+ var clipboard = Clipboard.Get (CopyOperation.CLIPBOARD_ATOM);
+ if (!clipboard.WaitIsTextAvailable ())
+ return null;
+ return clipboard.WaitForText ();
+ }
}
}