diff --git a/src/mudlib/embedded_if_session.py b/src/mudlib/embedded_if_session.py index 93b3b6a..490fcd7 100644 --- a/src/mudlib/embedded_if_session.py +++ b/src/mudlib/embedded_if_session.py @@ -38,12 +38,15 @@ class EmbeddedIFSession: def _strip_prompt(self, output: str) -> str: """Strip trailing > prompt from game output (matches dfrotz behavior).""" + has_prompt = ( + output.endswith("> ") or output.endswith(">\n") or output.endswith(">\r\n") + ) text = output.rstrip() if text.endswith("\n>"): return text[:-2].rstrip() if text == ">": return "" - if text.endswith(">"): + if has_prompt and text.endswith(">"): return text[:-1].rstrip() return output