From: Jeremy Stanley Date: Wed, 22 Apr 2020 19:54:54 +0000 (+0000) Subject: Record the reported rows from NAWS negotiation X-Git-Tag: 0.2.0~7 X-Git-Url: https://mudpy.org/gitweb?a=commitdiff_plain;h=8b0085791954dc96a909d49d3611c049a96b5c21;p=mudpy.git Record the reported rows from NAWS negotiation In preparation for future pagination support, get the rows included in NAWS responses and record that as an integer in the User.rows attribute, similar to the existing User.columns value used for line wrapping. --- diff --git a/mudpy/misc.py b/mudpy/misc.py index 0543aa1..074f538 100644 --- a/mudpy/misc.py +++ b/mudpy/misc.py @@ -501,6 +501,7 @@ class User: self.output_queue = [] self.partial_input = b"" self.password_tries = 0 + self.rows = 23 self.state = "telopt_negotiation" self.telopts = {} self.ttype = None diff --git a/mudpy/telnet.py b/mudpy/telnet.py index 35fb1c6..73331b9 100644 --- a/mudpy/telnet.py +++ b/mudpy/telnet.py @@ -269,6 +269,8 @@ def negotiate_telnet_options(user): if telopt is TELOPT_NAWS: user.columns = ( text[position + 3] * 256 + text[position + 4]) + user.rows = ( + text[position + 5] * 256 + text[position + 6]) elif telopt is TELOPT_TTYPE and text[position + 3] is IS: user.ttype = ( text[position + 4:end_subnegotiation]).decode("ascii")