Skip to content

Commit 054559a

Browse files
committed
Fixed SyntaxHighlighting
1 parent 1013b90 commit 054559a

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

Terminal.Gui/Views/TextView.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3646,7 +3646,7 @@ protected override bool OnDrawingContent ()
36463646

36473647
_isDrawing = false;
36483648

3649-
return true;
3649+
return false;
36503650
}
36513651

36523652
/// <inheritdoc/>

UICatalog/Scenarios/SyntaxHighlighting.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -281,17 +281,13 @@ private void ApplySyntaxHighlighting ()
281281
AllSuggestions = _keywords.ToList ()
282282
};
283283

284-
_textView.TextChanged += (s, e) => HighlightTextBasedOnKeywords ();
285-
_textView.DrawingContent += (s, e) => HighlightTextBasedOnKeywords ();
286-
_textView.DrawComplete += (s, e) => HighlightTextBasedOnKeywords ();
284+
// DrawingText happens before DrawingContent so we use it to highlight
285+
_textView.DrawingText += (s, e) => HighlightTextBasedOnKeywords ();
287286
}
288287

289288
private void ClearAllEvents ()
290289
{
291-
_textView.ClearEventHandlers ("TextChanged");
292-
_textView.ClearEventHandlers ("DrawContent");
293-
_textView.ClearEventHandlers ("DrawContentComplete");
294-
290+
_textView.ClearEventHandlers ("DrawingText");
295291
_textView.InheritsPreviousAttribute = false;
296292
}
297293

0 commit comments

Comments
 (0)