Record the reported rows from NAWS negotiation
authorJeremy Stanley <fungi@yuggoth.org>
Wed, 22 Apr 2020 19:54:54 +0000 (19:54 +0000)
committerJeremy Stanley <fungi@yuggoth.org>
Wed, 22 Apr 2020 19:54:54 +0000 (19:54 +0000)
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.

mudpy/misc.py
mudpy/telnet.py

index 0543aa1..074f538 100644 (file)
@@ -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
index 35fb1c6..73331b9 100644 (file)
@@ -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")