Skip to content

Commit de99090

Browse files
wufjonathanslenders
authored andcommitted
telnet client size changes were not detected by applications
get_app() should be called under contexvars, otherwise it returns the wrong application, or DummyApplication
1 parent 65c3d06 commit de99090

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/prompt_toolkit/contrib/telnet/server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ def data_received(data: bytes) -> None:
164164
def size_received(rows: int, columns: int) -> None:
165165
"""TelnetProtocolParser 'size_received' callback"""
166166
self.size = Size(rows=rows, columns=columns)
167-
if self.vt100_output is not None:
168-
get_app()._on_resize()
167+
if self.vt100_output is not None and self.context:
168+
self.context.run(lambda: get_app()._on_resize())
169169

170170
def ttype_received(ttype: str) -> None:
171171
"""TelnetProtocolParser 'ttype_received' callback"""

0 commit comments

Comments
 (0)