Beispiel #1
0
        /// <summary>
        /// Updates the current word.
        /// </summary>
        private void UpdateCurrentWord()
        {
            if ((view == null) || (view.Selection == null))
            {
                return;
            }

            // Save the old current word
            string oldCurrentWord = currentWord;

            // Get the current word and ensure it has only letter or number characters
            currentWord = view.GetCurrentWordText().Trim();
            Match match = wordCheck.Match(currentWord);

            if ((match == null) || (match.Index != 0) || (match.Length != currentWord.Length))
            {
                currentWord = String.Empty;
            }

            // If the current word changed...
            if (oldCurrentWord != currentWord)
            {
                // Notify that tags changed
                this.OnTagsChanged(new TagsChangedEventArgs(new TextSnapshotRange(view.SyntaxEditor.Document.CurrentSnapshot, view.SyntaxEditor.Document.CurrentSnapshot.TextRange)));
            }
        }