GetWholeWord() public static method

public static GetWholeWord ( TextDocument document, TextEditor textEditor ) : string
document ICSharpCode.AvalonEdit.Document.TextDocument
textEditor TextEditor
return string
        private void _caret_PositionChanged(object sender, EventArgs e)
        {
            try {
                string currentWord = AvalonLoader.GetWholeWord(_textEditor.TextArea.Document, _textEditor);

                if (_textEditor.CaretOffset > 0)
                {
                    if (currentWord.Length <= 0 || !char.IsLetterOrDigit(currentWord[0]))
                    {
                        foreach (char c in new char[] { '{', '}', '(', ')', '[', ']' })
                        {
                            if (_isBefore(c) || _isAfter(c))
                            {
                                currentWord = "" + c;
                            }
                        }
                    }
                }

                if (_currentWord != currentWord)
                {
                    _renderer.CurrentResults.Clear();
                    _textArea.TextView.InvalidateLayer(KnownLayer.Selection);
                }

                _currentWord = currentWord;
                _updateCurrentWord(currentWord);
            }
            catch {
            }
        }
Example #2
0
        private void _caret_PositionChanged(object sender, EventArgs e)
        {
            try {
                string currentWord = AvalonLoader.GetWholeWord(_textEditor.TextArea.Document, _textEditor);

                if (_currentWord != currentWord)
                {
                    _renderer.CurrentResults.Clear();
                    _textArea.TextView.InvalidateLayer(KnownLayer.Selection);
                }

                _currentWord = currentWord;
                _updateCurrentWord(currentWord);
            }
            catch { }
        }