Browse Source

Don't show the context action popup when the caret is outside the editor boundaries

pull/38/head
Daniel Grunwald 12 years ago
parent
commit
8c555650d9
  1. 8
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/ContextActionsRenderer.cs

8
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/ContextActionsRenderer.cs

@ -7,6 +7,7 @@ using System.Collections.ObjectModel; @@ -7,6 +7,7 @@ using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;
using System.Threading;
using System.Windows;
using System.Windows.Input;
using System.Windows.Threading;
@ -120,6 +121,13 @@ namespace ICSharpCode.AvalonEdit.AddIn.ContextActions @@ -120,6 +121,13 @@ namespace ICSharpCode.AvalonEdit.AddIn.ContextActions
return;
ClosePopup();
// Don't show the context action popup when the caret is outside the editor boundaries
var textView = this.editorView.TextArea.TextView;
Rect editorRect = new Rect((Point)textView.ScrollOffset, textView.RenderSize);
Rect caretRect = this.editorView.TextArea.Caret.CalculateCaretRectangle();
if (!editorRect.Contains(caretRect))
return;
ContextActionsBulbViewModel popupVM = BuildPopupViewModel();
this.cancellationTokenSourceForPopupBeingOpened = new CancellationTokenSource();
var cancellationToken = cancellationTokenSourceForPopupBeingOpened.Token;

Loading…
Cancel
Save