From 6945eb4186d3c7951e358b08d8d7d41a55f2a835 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 11 Jul 2021 21:33:19 +0530 Subject: [PATCH] Better complete debug function --- kitty/complete.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kitty/complete.py b/kitty/complete.py index 2bee3b797..f925b90c5 100644 --- a/kitty/complete.py +++ b/kitty/complete.py @@ -79,8 +79,12 @@ class MatchGroup: def debug(*a: Any, **kw: Any) -> None: - kw['file'] = sys.stderr - print(*a, **kw) + from kittens.tui.loop import Debug + if not hasattr(debug, 'output'): + d = Debug() + d.fobj = sys.stderr.buffer # type: ignore + setattr(debug, 'output', d) + getattr(debug, 'output')(*a, **kw) class Delegate: