Browse Source

Fixed SyntaxHighlighting

Tig 8 months ago
parent
commit
054559a6ae
2 changed files with 4 additions and 8 deletions
  1. 1 1
      Terminal.Gui/Views/TextView.cs
  2. 3 7
      UICatalog/Scenarios/SyntaxHighlighting.cs

+ 1 - 1
Terminal.Gui/Views/TextView.cs

@@ -3646,7 +3646,7 @@ public class TextView : View
 
         _isDrawing = false;
 
-        return true;
+        return false;
     }
 
     /// <inheritdoc/>

+ 3 - 7
UICatalog/Scenarios/SyntaxHighlighting.cs

@@ -281,17 +281,13 @@ public class SyntaxHighlighting : Scenario
             AllSuggestions = _keywords.ToList ()
         };
 
-        _textView.TextChanged += (s, e) => HighlightTextBasedOnKeywords ();
-        _textView.DrawingContent += (s, e) => HighlightTextBasedOnKeywords ();
-        _textView.DrawComplete += (s, e) => HighlightTextBasedOnKeywords ();
+        // DrawingText happens before DrawingContent so we use it to highlight
+        _textView.DrawingText += (s, e) => HighlightTextBasedOnKeywords ();
     }
 
     private void ClearAllEvents ()
     {
-        _textView.ClearEventHandlers ("TextChanged");
-        _textView.ClearEventHandlers ("DrawContent");
-        _textView.ClearEventHandlers ("DrawContentComplete");
-
+        _textView.ClearEventHandlers ("DrawingText");
         _textView.InheritsPreviousAttribute = false;
     }