Skip to content

gh-157928: PyREPL detect OSC sequences - #157932

Open
edvilme wants to merge 9 commits into
python:mainfrom
edvilme:pyrepl-osc-escape-sequences
Open

edvilme wants to merge 9 commits into
python:mainfrom
edvilme:pyrepl-osc-escape-sequences

Conversation

@edvilme

@edvilme edvilme commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Improve how PyREPL detects and handles OSC (Operating System Command) sequences so that they are properly recognized and accounted for when calculating string widths and rendering lines.

Enhanced the ANSI_ESCAPE_SEQUENCE regex in Lib/_pyrepl/utils.py to correctly match both CSI and OSC sequences, enabling accurate detection of OSC controls.

Before

Image Image

After

image

edvilme added a commit to microsoft/vscode-python that referenced this pull request Sep 30, 2026
Related python/cpython#157932
Related #25467

Modifies `_pyrepl.utils.ANSI_ESCAPE_SEQUENCE` to correctly support
VSCode's OSC sequences and prevent cursor misplacing when using the REPL
inside vscode.

Refactorings for easier maintainability
Comment thread Lib/_pyrepl/utils.py Outdated
Comment thread Misc/NEWS.d/next/Library/2026-09-21-21-07-12.gh-issue-157928.ZPlNYC.rst Outdated
Comment thread Lib/test/test_pyrepl/test_utils.py Outdated
Comment thread Lib/test/test_pyrepl/test_utils.py Outdated
Comment thread Lib/test/test_pyrepl/test_render.py Outdated
@bedevere-app

bedevere-app Bot commented Oct 1, 2026

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

Co-authored-by: Brett Cannon <brett@python.org>
@bedevere-app bedevere-app Bot added the type-feature A feature request or enhancement label Oct 1, 2026
@edvilme

edvilme commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

I have made the requested changes; please review again

@bedevere-app

bedevere-app Bot commented Oct 2, 2026

Copy link
Copy Markdown

Thanks for making the requested changes!

@brettcannon: please review the changes made to this pull request.

@bedevere-app
bedevere-app Bot requested a review from brettcannon October 2, 2026 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting change review type-feature A feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants