diff options
author | Mike Krüger <mkrueger@xamarin.com> | 2012-06-01 13:40:31 +0400 |
---|---|---|
committer | Mike Krüger <mkrueger@xamarin.com> | 2012-06-01 13:40:31 +0400 |
commit | 99ae3e0355c89022a690daa56875c2b6978e1662 (patch) | |
tree | 95af5f23cdcd920ea54987431ec3cbc4674b0fd5 | |
parent | 055bc5fd592d1e4d9be6bd54f2c9ad7e68974ffa (diff) |
Fixed 'Bug 5344 - Quick fix icon blinks when moving caret with arrow
keys '.
-rw-r--r-- | main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs | 35 | ||||
-rw-r--r-- | main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextEditorContainer.cs | 6 |
2 files changed, 28 insertions, 13 deletions
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs index d5ca1dffb9..806781a40e 100644 --- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs +++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs @@ -68,37 +68,50 @@ namespace MonoDevelop.CodeActions void CreateWidget (IEnumerable<CodeAction> fixes, TextLocation loc) { Fixes = fixes; - if (!QuickTaskStrip.EnableFancyFeatures) + if (!QuickTaskStrip.EnableFancyFeatures) { + RemoveWidget (); return; + } var editor = document.Editor; - if (editor == null || editor.Parent == null || !editor.Parent.IsRealized) + if (editor == null || editor.Parent == null || !editor.Parent.IsRealized) { + RemoveWidget (); return; - if (document.ParsedDocument == null || document.ParsedDocument.IsInvalid) + } + if (document.ParsedDocument == null || document.ParsedDocument.IsInvalid) { + RemoveWidget (); return; + } if (!fixes.Any ()) { ICSharpCode.NRefactory.Semantics.ResolveResult resolveResult; ICSharpCode.NRefactory.CSharp.AstNode node; if (ResolveCommandHandler.ResolveAt (document, out resolveResult, out node)) { var possibleNamespaces = ResolveCommandHandler.GetPossibleNamespaces (document, node, resolveResult); - if (!possibleNamespaces.Any ()) + if (!possibleNamespaces.Any ()) { + RemoveWidget (); return; - } else + } + } else { + RemoveWidget (); return; + } } var container = editor.Parent.Parent as TextEditorContainer; - if (container == null) + if (container == null) { + RemoveWidget (); return; + } if (widget == null) { widget = new CodeActionWidget (this, Document); container.AddTopLevelWidget (widget, 2 + (int)editor.Parent.TextViewMargin.XOffset, -2 + (int)editor.Parent.LineToY (document.Editor.Caret.Line)); } else { + if (!widget.Visible) + widget.Show (); container.MoveTopLevelWidget (widget, 2 + (int)editor.Parent.TextViewMargin.XOffset, -2 + (int)editor.Parent.LineToY (document.Editor.Caret.Line)); } - widget.Show (); widget.SetFixes (fixes, loc); } @@ -112,21 +125,21 @@ namespace MonoDevelop.CodeActions public override void CursorPositionChanged () { - RemoveWidget (); CancelQuickFixTimer (); - + if (QuickTaskStrip.EnableFancyFeatures && Document.ParsedDocument != null) { quickFixTimeout = GLib.Timeout.Add (100, delegate { var loc = Document.Editor.Caret.Location; RefactoringService.QueueQuickFixAnalysis (Document, loc, delegate(List<CodeAction> fixes) { Application.Invoke (delegate { - RemoveWidget (); CreateWidget (fixes, loc); + quickFixTimeout = 0; }); }); - quickFixTimeout = 0; return false; }); + } else { + RemoveWidget (); } base.CursorPositionChanged (); } diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextEditorContainer.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextEditorContainer.cs index 8041f649e4..91cddfe5f9 100644 --- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextEditorContainer.cs +++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextEditorContainer.cs @@ -110,6 +110,8 @@ namespace Mono.TextEditor { foreach (EditorContainerChild info in containerChildren.ToArray ()) { if (info.Child == widget || (info.Child is AnimatedWidget && ((AnimatedWidget)info.Child).Widget == widget)) { + if (info.X == x && info.Y == y) + break; info.X = x; info.Y = y; if (widget.Visible) @@ -219,8 +221,8 @@ namespace Mono.TextEditor childRectangle.X = (int)(child.X * zoom - textEditorWidget.HAdjustment.Value); childRectangle.Y = (int)(child.Y * zoom - textEditorWidget.VAdjustment.Value); } - childRectangle.X += allocation.X; - childRectangle.Y += allocation.Y; +// childRectangle.X += allocation.X; +// childRectangle.Y += allocation.Y; child.Child.SizeAllocate (childRectangle); } |