SIGN IN SIGN UP

gh-130472: Remove readline-only hacks from PyREPL completions (#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.
P
Pablo Galindo Salgado committed
f8293faf37971fd0d4d30c0c83df2ac654e610a1
Parent: 36f15ba
Committed by GitHub <noreply@github.com> on 4/6/2026, 2:57:25 PM