FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-130472: Remove readline-only hacks from PyREPL completions by pablogsal · Pull Request #148161 · python/cpython · GitHub

Repository navigation

gh-130472: Remove readline-only hacks from PyREPL completions - #148161

Merged
pablogsal merged 1 commit into
python:mainfrom
pablogsal:gh-130472
Apr 6, 2026
Merged

pablogsal merged 1 commit into
python:mainfrom
pablogsal:gh-130472

Conversation

pablogsal commented Apr 6, 2026 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Member

PyREPL was still carrying over two readline-specific tricks from the
fancy completer: a synthetic CSI prefix to influence sorting and a fake
blank completion entry to suppress readline's prefix insertion. Those
workarounds are not appropriate in PyREPL because the reader already
owns completion ordering and menu rendering, so the fake entries leaked
into the UI as real terminal attributes and empty menu cells.

Sort completion candidates in ReadlineAlikeReader by their visible text
with stripcolor(), and let the fancy completer return only real matches.
That keeps colored completions stable without emitting bogus escape
sequences, removes the empty completion slot, and adds regression tests
for both the low-level completer output and the reader integration.

PyREPL was still carrying over two readline-specific tricks from the
fancy completer: a synthetic CSI prefix to influence sorting and a fake
blank completion entry to suppress readline's prefix insertion. Those
workarounds are not appropriate in PyREPL because the reader already
owns completion ordering and menu rendering, so the fake entries leaked
into the UI as real terminal attributes and empty menu cells.

Sort completion candidates in ReadlineAlikeReader by their visible text
with stripcolor(), and let the fancy completer return only real matches.
That keeps colored completions stable without emitting bogus escape
sequences, removes the empty completion slot, and adds regression tests
for both the low-level completer output and the reader integration.

Copy link
Copy Markdown
Member

It fixes my issues,

is it possible to have deeper alphabetic sorting, above all of the Py_ are jumbled together?

hugovk commented Apr 6, 2026

Copy link
Copy Markdown
Member

Also good now:


is it possible to have deeper alphabetic sorting, above all of the Py_ are jumbled together?

Looks like it's case-sensitive alphabetical, do you mean case-insensitive?

StanFromIreland commented Apr 6, 2026 •
edited
Loading

Copy link
Copy Markdown
Member

case-sensitive alphabetical

I mean case-sensitive alphabetical, but to not stop at the second character, _.

Copy link
Copy Markdown
Member Author

I mean case-sensitive alphabetical, but to not stop at the second character, _.

Let me see what I can do

Copy link
Copy Markdown
Member Author

Check the latest commit. If you mean something different you are going to need to explain in more detail what you have in mind :)

StanFromIreland left a comment

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Oh sorry, you can revert the last commit, the current is better. I reviewed a7f83bd, LGTM

pablogsal enabled auto-merge (squash) April 6, 2026 14:29
pablogsal merged commit f8293fa into python:main Apr 6, 2026
114 checks passed
pablogsal deleted the gh-130472 branch April 6, 2026 14:57
ljfp pushed a commit to ljfp/cpython that referenced this pull request Apr 25, 2026
…ython#148161)

PyREPL was still carrying over two readline-specific tricks from the
fancy completer: a synthetic CSI prefix to influence sorting and a fake
blank completion entry to suppress readline's prefix insertion. Those
workarounds are not appropriate in PyREPL because the reader already
owns completion ordering and menu rendering, so the fake entries leaked
into the UI as real terminal attributes and empty menu cells.

Sort completion candidates in ReadlineAlikeReader by their visible text
with stripcolor(), and let the fancy completer return only real matches.
That keeps colored completions stable without emitting bogus escape
sequences, removes the empty completion slot, and adds regression tests
for both the low-level completer output and the reader integration.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL