コード例 #1
0
        public void SetText(string text, bool isDiff = false)
        {
            _lineNumbersControl.Clear();

            if (isDiff)
            {
                TextEditor.ShowLineNumbers = false;
                _lineNumbersControl.SetVisibility(true);
                var index = TextEditor.ActiveTextAreaControl.TextArea.LeftMargins.IndexOf(_lineNumbersControl);
                if (index == -1)
                {
                    TextEditor.ActiveTextAreaControl.TextArea.InsertLeftMargin(0, _lineNumbersControl);
                }

                _diffHighlightService = DiffHighlightService.IsCombinedDiff(text)
                    ? CombinedDiffHighlightService.Instance
                    : DiffHighlightService.Instance;
            }
            else
            {
                TextEditor.ShowLineNumbers = true;
                _lineNumbersControl.SetVisibility(false);
            }

            TextEditor.Text = text;
            _isGotoLineUIApplicable = !isDiff;

            if (isDiff)
            {
                _diffLineNumAnalyzer.StartAsync(text, () =>
                {
                    if (TextEditor != null && !TextEditor.Disposing && TextEditor.Visible)
                    {
                        TextEditor.ActiveTextAreaControl.TextArea.Refresh();
                    }
                });
            }

            TextEditor.Refresh();
        }
コード例 #2
0
        public void SetText(string text, bool isDiff = false)
        {
            _lineNumbersControl.Clear(isDiff);

            if (isDiff)
            {
                TextEditor.ShowLineNumbers = false;
                _lineNumbersControl.SetVisibility(true);
                var index = TextEditor.ActiveTextAreaControl.TextArea.LeftMargins.IndexOf(_lineNumbersControl);
                if (index == -1)
                {
                    TextEditor.ActiveTextAreaControl.TextArea.InsertLeftMargin(0, _lineNumbersControl);
                }

                _diffHighlightService = DiffHighlightService.IsCombinedDiff(text)
                    ? CombinedDiffHighlightService.Instance
                    : DiffHighlightService.Instance;
            }
            else
            {
                TextEditor.ShowLineNumbers = true;
                _lineNumbersControl.SetVisibility(false);
            }

            TextEditor.Text = text;
            _isGotoLineUIApplicable = !isDiff;

            if (isDiff)
            {
                _lineNumbersControl.DisplayLineNumFor(text);
            }
            TextEditor.Refresh();
        }