Explorar o código

Fixed SyntaxHighlighting

Tig hai 8 meses
pai
achega
054559a6ae

+ 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;
     }