Strip dfrotz prompt even with trailing whitespace
This commit is contained in:
parent
b90e61c4fc
commit
05c9a48bb3
1 changed files with 9 additions and 4 deletions
|
|
@ -203,16 +203,21 @@ class IFSession:
|
||||||
buf += chunk
|
buf += chunk
|
||||||
|
|
||||||
# Check for prompt at end of buffer
|
# 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>"):
|
if text.endswith("\n>"):
|
||||||
text = text[:-2]
|
return text[:-2].rstrip()
|
||||||
return text.rstrip()
|
|
||||||
if text == ">":
|
if text == ">":
|
||||||
return ""
|
return ""
|
||||||
except TimeoutError:
|
except TimeoutError:
|
||||||
pass
|
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:
|
async def broadcast_to_spectators(player: "Player", message: str) -> None:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue