コード例 #1
0
ファイル: CodeTextEditor.cs プロジェクト: vnvizitiu/RoslynPad
        public CodeTextEditor()
        {
            Options = new TextEditorOptions
            {
                ConvertTabsToSpaces      = true,
                AllowScrollBelowDocument = true,
                IndentationSize          = 4,
                EnableEmailHyperlinks    = false,
            };
            ShowLineNumbers = true;

            MouseHover        += OnMouseHover;
            MouseHoverStopped += OnMouseHoverStopped;
            TextArea.TextView.VisualLinesChanged += OnVisualLinesChanged;
            TextArea.TextEntering += OnTextEntering;
            TextArea.TextEntered  += OnTextEntered;

            ToolTipService.SetInitialShowDelay(this, 0);
            SearchReplacePanel.Install(this);

            var commandBindings   = TextArea.CommandBindings;
            var deleteLineCommand = commandBindings.OfType <CommandBinding>().FirstOrDefault(x => x.Command == AvalonEditCommands.DeleteLine);

            if (deleteLineCommand != null)
            {
                commandBindings.Remove(deleteLineCommand);
            }
        }
コード例 #2
0
        /// <summary>
        /// Creates a SearchReplacePanel and installs it to the TextArea.
        /// </summary>
        public new static SearchReplacePanel Install(TextArea textArea)
        {
            if (textArea == null)
            {
                throw new ArgumentNullException(nameof(textArea));
            }
            var panel = new SearchReplacePanel {
                _textArea = textArea
            };

            typeof(SearchPanel).GetMethod("AttachInternal", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(panel, new object[] { textArea });
            panel.AttachInternal();
            panel._handler = new SearchReplaceInputHandler(textArea, panel);
            textArea.DefaultInputHandler.NestedInputHandlers.Add(panel._handler);
            return(panel);
        }
コード例 #3
0
 internal SearchReplaceInputHandler(TextArea textArea, SearchReplacePanel panel)
     : base(textArea)
 {
     RegisterCommands();
     _panel = panel;
 }