diff options
author | Mike Krüger <mkrueger@xamarin.com> | 2015-02-26 21:02:59 +0300 |
---|---|---|
committer | Mike Krüger <mkrueger@xamarin.com> | 2015-02-26 21:02:59 +0300 |
commit | 13563274f0198b895e2421b7d314747ceb9769a4 (patch) | |
tree | ac515dd1022681a48d23c69c77a7dd0bd9e56db7 /main/src/addins/MonoDevelop.SourceEditor2 | |
parent | e8120ebd0c9ee45a83e48ae431e65797c172403f (diff) |
[SourceEditor] Fixed usage highlighting on the fly toggleing.
Diffstat (limited to 'main/src/addins/MonoDevelop.SourceEditor2')
-rw-r--r-- | main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/AbstractUsagesExtension.cs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/AbstractUsagesExtension.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/AbstractUsagesExtension.cs index a88335d795..b2e4e24551 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/AbstractUsagesExtension.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/AbstractUsagesExtension.cs @@ -67,6 +67,14 @@ namespace MonoDevelop.SourceEditor TextEditorData.Caret.PositionChanged += HandleTextEditorDataCaretPositionChanged; TextEditorData.Document.TextReplaced += HandleTextEditorDataDocumentTextReplaced; TextEditorData.SelectionChanged += HandleTextEditorDataSelectionChanged; + PropertyService.PropertyChanged += PropertyService_PropertyChanged; + } + + void PropertyService_PropertyChanged (object sender, PropertyChangedEventArgs e) + { + if (e.Key != "EnableHighlightUsages") + return; + HandleTextEditorDataCaretPositionChanged (null, null); } void HandleTextEditorDataSelectionChanged (object sender, EventArgs e) @@ -83,7 +91,7 @@ namespace MonoDevelop.SourceEditor public override void Dispose () { CancelTooltip (); - + PropertyService.PropertyChanged -= PropertyService_PropertyChanged; TextEditorData.SelectionChanged -= HandleTextEditorDataSelectionChanged; TextEditorData.Caret.PositionChanged -= HandleTextEditorDataCaretPositionChanged; TextEditorData.Document.TextReplaced -= HandleTextEditorDataDocumentTextReplaced; @@ -158,8 +166,11 @@ namespace MonoDevelop.SourceEditor void HandleTextEditorDataCaretPositionChanged (object sender, DocumentLocationEventArgs e) { - if (!DefaultSourceEditorOptions.Instance.EnableHighlightUsages) + if (!DefaultSourceEditorOptions.Instance.EnableHighlightUsages) { + RemoveMarkers (); + RemoveTimer (); return; + } if (!TextEditorData.IsSomethingSelected && markers.Values.Any (m => m.Contains (TextEditorData.Caret.Offset))) return; RemoveMarkers (); |