diff --git a/src/textual/_xterm_parser.py b/src/textual/_xterm_parser.py index 0391cfcded..ddb935f505 100644 --- a/src/textual/_xterm_parser.py +++ b/src/textual/_xterm_parser.py @@ -1,5 +1,6 @@ from __future__ import annotations +import os import re from typing import Any, Generator, Iterable @@ -42,6 +43,9 @@ ) +IS_ITERM = os.environ.get("TERM_PROGRAM", "") == "iTerm.app" + + class XTermParser(Parser[Message]): _re_sgr_mouse = re.compile(r"\x1b\[<(\d+);(\d+);(\d+)([Mm])") @@ -262,7 +266,8 @@ def send_escape() -> None: setting_parameter = int(mode_report_match["setting_parameter"]) if mode_id == "2026" and setting_parameter > 0: on_token(messages.TerminalSupportsSynchronizedOutput()) - elif mode_id == "2048": + elif mode_id == "2048" and not IS_ITERM: + # TODO: remove "and not IS_ITERM" when https://gitlab.com/gnachman/iterm2/-/issues/11961 is fixed in_band_event = messages.TerminalSupportInBandWindowResize.from_setting_parameter( setting_parameter )