Merge pull request #3498 from michaelfaith84/terminal_resizing
Automatic Terminal resizing
This commit is contained in:
commit
97119bc21a
6 changed files with 22 additions and 3 deletions
|
|
@ -58,6 +58,7 @@ class Naws:
|
|||
option (Option): Not used.
|
||||
|
||||
"""
|
||||
self.protocol.protocol_flags["AUTORESIZE"] = False
|
||||
self.protocol.handshake_done()
|
||||
|
||||
def do_naws(self, option):
|
||||
|
|
@ -68,6 +69,7 @@ class Naws:
|
|||
option (Option): Not used.
|
||||
|
||||
"""
|
||||
self.protocol.protocol_flags["AUTORESIZE"] = True
|
||||
self.protocol.handshake_done()
|
||||
|
||||
def negotiate_sizes(self, options):
|
||||
|
|
|
|||
|
|
@ -467,7 +467,7 @@ class PortalSessionHandler(SessionHandler):
|
|||
kwargs (any): Each key is a command instruction to the
|
||||
protocol on the form key = [[args],{kwargs}]. This will
|
||||
call a method send_<key> on the protocol. If no such
|
||||
method exixts, it sends the data to a method send_default.
|
||||
method exits, it sends the data to a method send_default.
|
||||
|
||||
"""
|
||||
# from evennia.server.profiling.timetrace import timetrace # DEBUG
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ from twisted.internet.task import LoopingCall
|
|||
from evennia.server.portal import mssp, naws, suppress_ga, telnet_oob, ttype
|
||||
from evennia.server.portal.mccp import MCCP, Mccp, mccp_compress
|
||||
from evennia.server.portal.mxp import Mxp, mxp_parse
|
||||
from evennia.server.portal.naws import NAWS
|
||||
from evennia.utils import ansi
|
||||
from evennia.utils.utils import class_from_module, to_bytes
|
||||
|
||||
|
|
@ -91,8 +92,14 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, _BASE_SESSION_CLASS):
|
|||
of incoming data.
|
||||
|
||||
"""
|
||||
# print(f"telnet dataReceived: {data}")
|
||||
try:
|
||||
# Do we have a NAWS update?
|
||||
if (NAWS in data and
|
||||
len([data[i:i+1] for i in range(0, len(data))]) == 9 and
|
||||
# Is auto resizing on?
|
||||
self.protocol_flags.get('AUTORESIZE')):
|
||||
self.sessionhandler.sync(self.sessionhandler.get(self.sessid))
|
||||
|
||||
super().dataReceived(data)
|
||||
except ValueError as err:
|
||||
from evennia.utils import logger
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue