diff --git a/src/python/adgui.py b/src/python/adgui.py
index 3f4fb9b1..0f0bbf10 100755
--- a/src/python/adgui.py
+++ b/src/python/adgui.py
@@ -257,7 +257,7 @@ class adgui(QObject):
elif level < ad.MSG_TRACE:
html = f"{s}
\n"
if s != "" and s != "\n":
- new_bol = s[-1] == '\n'
+ new_bol = not no_nl or (s[-1] == '\n')
if not no_nl:
s += '\n'
# always save non-empty messages to debug log