Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pyte/screens.py
Original file line number Diff line number Diff line change
Expand Up @@ -971,11 +971,15 @@ def alignment_display(self) -> None:
for x in range(self.columns):
self.buffer[y][x] = self.buffer[y][x]._replace(data="E")

def select_graphic_rendition(self, *attrs: int) -> None:
def select_graphic_rendition(self, *attrs: int, private: bool = False) -> None:
"""Set display attributes.

:param list attrs: a list of display attributes to set.
:param bool private: if True, ignore the SGR sequence (private sequences are not supported).
"""
if private:
return

replace = {}

# Fast path for resetting all attributes.
Expand Down
21 changes: 21 additions & 0 deletions tests/test_screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1583,3 +1583,24 @@ def test_screen_set_icon_name_title():

screen.set_title(text)
assert screen.title == text


def test_private_sgr_sequence_ignored():
def cursor_state(cursor):
return (cursor.x, cursor.y, cursor.attrs, cursor.hidden)

screen = pyte.HistoryScreen(2, 2)
stream = pyte.ByteStream(screen)

# Capture initial state
display = screen.display
mode = screen.mode.copy()
cursor = cursor_state(screen.cursor)

# Vim 9.0+ sends this to query modifyOtherKeys capability - should be ignored
stream.feed(b'\x1b[?4m')

# Verify nothing changed
assert screen.display == display
assert screen.mode == mode
assert cursor_state(screen.cursor) == cursor