-
Notifications
You must be signed in to change notification settings - Fork 115
Fix TypeError in select_graphic_rendition #203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
pyte/screens.py
Outdated
| 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, **kwargs: Any) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be private: bool = False so that we don't allow arbitrary kwargs here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you're absolutely right. Using private: bool = False is much better than **kwargs.
I used the existing **kwargs pattern as a reference from other methods in the codebase, but you're correct that explicit parameters are better. I noticed that set_mode(), reset_mode(), erase_in_display(), and report_device_attributes() also use the same pattern for the private parameter. Should I refactor those methods for consistency as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep the rest as is and only change select_graphic_rendition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
808df45 to
eaa831d
Compare
superbobry
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
|
Would you mind adding a test for this to avoid regressions in the future? |
- Add private parameter to select_graphic_rendition() method signature - Handle private=True parameter by returning early (no-op for private SGR sequences)
- Add test_private_sgr_sequence_ignored() to verify Vim 9.0+ modifyOtherKeys query is ignored - Test ensures private SGR sequences don't affect screen display, modes, or cursor state
eaa831d to
48d43d4
Compare
Done |
Fixes #202
privateparameter to select_graphic_rendition() method signatureprivate=Trueparameter by returning early (no-op for private SGR sequences)