Skip to content

gh-153401: Highlight matching delimiters in the REPL - #160038

Draft
johnslavik wants to merge 1 commit into
python:mainfrom
johnslavik:repl-matching-delimiters
Draft

johnslavik wants to merge 1 commit into
python:mainfrom
johnslavik:repl-matching-delimiters

Conversation

@johnslavik

@johnslavik johnslavik commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

@johnslavik
johnslavik force-pushed the repl-matching-delimiters branch from 5380891 to 9f4d9d6 Compare October 21, 2026 14:48
@bedevere-app bedevere-app Bot added the type-feature A feature request or enhancement label Oct 21, 2026
@github-project-automation github-project-automation Bot moved this to Todo in Sprint Oct 21, 2026
@python python deleted a comment from read-the-docs-community Bot Oct 21, 2026
@johnslavik
johnslavik force-pushed the repl-matching-delimiters branch from 95ec6ed to cc50e86 Compare October 21, 2026 21:10
@read-the-docs-community

read-the-docs-community Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #36186453 | 📁 Comparing f731b92 against main (4372120)

  🔍 Preview build  

214 files changed · + 1 added · ± 213 modified

+ Added

± Modified

@pablogsal
pablogsal force-pushed the repl-matching-delimiters branch from cc50e86 to f731b92 Compare November 26, 2026 11:25
Comment thread Lib/_pyrepl/reader.py
for i in (self.pos, self.pos - 1)
):
return None
return find_matching_delimiter(self.get_unicode(), self.pos)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we reuse the tokens here? On a debug build, a lookup in a 10,000-line buffer took about 130 ms each time the cursor moved to a delimiter.

@johnslavik johnslavik Nov 26, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I tried it before and it looked unnecessarily complicated. I assumed the sizes of buffer where it matters cannot be realistically hit in real use. But since you're bringing this, I will give it another try.

@parulgupta1004 parulgupta1004 added the topic-repl Related to the interactive shell label Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sprint topic-repl Related to the interactive shell type-feature A feature request or enhancement

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants