From 05c9a48bb350351b2a9e30cd41872e5b4af935f0 Mon Sep 17 00:00:00 2001 From: Jared Miller Date: Mon, 9 Feb 2026 17:28:28 -0500 Subject: [PATCH] Strip dfrotz prompt even with trailing whitespace --- src/mudlib/if_session.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/mudlib/if_session.py b/src/mudlib/if_session.py index 3ddca96..669eb6c 100644 --- a/src/mudlib/if_session.py +++ b/src/mudlib/if_session.py @@ -203,16 +203,21 @@ class IFSession: buf += chunk # Check for prompt at end of buffer - text = buf.decode("latin-1") + # dfrotz prompt is "\n> " (with trailing space) + text = buf.decode("latin-1").rstrip() if text.endswith("\n>"): - text = text[:-2] - return text.rstrip() + return text[:-2].rstrip() if text == ">": return "" except TimeoutError: pass - return buf.decode("latin-1").rstrip() + text = buf.decode("latin-1").rstrip() + if text.endswith("\n>"): + return text[:-2].rstrip() + if text == ">": + return "" + return text async def broadcast_to_spectators(player: "Player", message: str) -> None: