[terminal buffering] Remove the management of the iTerm2-specific buffering protocol

Since iTerm2 also supports the "mode 2026", we can just rely on that one ✌
This commit is contained in:
Olivier Philippon
2022-05-20 16:22:36 +01:00
parent d14659c1a3
commit 3486dc08b5
6 changed files with 32 additions and 35 deletions

View File

@@ -15,7 +15,9 @@ from textual import events, errors
from textual._clock import _Clock
from textual.app import WINDOWS
from textual._context import active_app
from textual._ansi_sequences import TERMINAL_MODES_ANSI_SEQUENCES
from textual._terminal_features import TerminalSupportedFeatures
from textual._terminal_modes import Mode
from textual.app import App, ComposeResult
from textual.driver import Driver
from textual.geometry import Size, Region
@@ -23,8 +25,9 @@ from textual.geometry import Size, Region
# N.B. These classes would better be named TestApp/TestConsole/TestDriver/etc,
# but it makes pytest emit warning as it will try to collect them as classes containing test cases :-/
# This value is also hard-coded in Textual's `App` class:
CLEAR_SCREEN_SEQUENCE = "\x1bP=1s\x1b\\"
CLEAR_SCREEN_SEQUENCE = TERMINAL_MODES_ANSI_SEQUENCES[Mode.SynchronizedOutput][
"start_sync"
]
class AppTest(App):
@@ -47,12 +50,11 @@ class AppTest(App):
# Let's disable all features by default
self.features = frozenset()
# We need this so the iTerm2 `CLEAR_SCREEN_SEQUENCE` is always sent for a screen refresh,
# We need this so the `CLEAR_SCREEN_SEQUENCE` is always sent for a screen refresh,
# whatever the environment:
# (we use it to slice the output into distinct full screens displays)
self._terminal_features = TerminalSupportedFeatures(
iterm2_synchronized_update=True,
mode2026_synchronized_update=False,
mode2026_synchronized_update=True,
)
self._size = size
@@ -347,9 +349,8 @@ class ClockMock(_Clock):
# ...and let's mark it for removal:
activated_events_times_to_clear.append(monotonic_time)
if activated_events_times_to_clear:
for event_time_to_clear in activated_events_times_to_clear:
del self._pending_sleep_events[event_time_to_clear]
for event_time_to_clear in activated_events_times_to_clear:
del self._pending_sleep_events[event_time_to_clear]
return activated_timers_count