Exemple #1
0
 public TextSelection(IWpfTextView textView, IAdornmentLayer selectionLayer, IEditorFormatMap editorFormatMap)
 {
     if (selectionLayer == null)
     {
         throw new ArgumentNullException(nameof(selectionLayer));
     }
     if (editorFormatMap == null)
     {
         throw new ArgumentNullException(nameof(editorFormatMap));
     }
     TextView    = textView ?? throw new ArgumentNullException(nameof(textView));
     Mode        = TextSelectionMode.Stream;
     activePoint = anchorPoint = new VirtualSnapshotPoint(TextView.TextSnapshot, 0);
     TextView.TextBuffer.ChangedHighPriority += TextBuffer_ChangedHighPriority;
     TextView.Options.OptionChanged          += Options_OptionChanged;
     TextView.GotAggregateFocus  += TextView_GotAggregateFocus;
     TextView.LostAggregateFocus += TextView_LostAggregateFocus;
     textSelectionLayer           = new TextSelectionLayer(this, selectionLayer, editorFormatMap);
     ActivationTracksFocus        = true;
 }
Exemple #2
0
		public TextSelection(IWpfTextView textView, IAdornmentLayer selectionLayer, IEditorFormatMap editorFormatMap) {
			if (textView == null)
				throw new ArgumentNullException(nameof(textView));
			if (selectionLayer == null)
				throw new ArgumentNullException(nameof(selectionLayer));
			if (editorFormatMap == null)
				throw new ArgumentNullException(nameof(editorFormatMap));
			TextView = textView;
			Mode = TextSelectionMode.Stream;
			activePoint = anchorPoint = new VirtualSnapshotPoint(TextView.TextSnapshot, 0);
			TextView.TextBuffer.ChangedHighPriority += TextBuffer_ChangedHighPriority;
			TextView.Options.OptionChanged += Options_OptionChanged;
			TextView.GotAggregateFocus += TextView_GotAggregateFocus;
			TextView.LostAggregateFocus += TextView_LostAggregateFocus;
			textSelectionLayer = new TextSelectionLayer(this, selectionLayer, editorFormatMap);
			ActivationTracksFocus = true;
		}