Repository navigation
gh-148228: Enable error overlays in the REPL - #148229
Merged
Merged
Conversation
johnslavik
requested review from
ambv,
hugovk,
lysnikolaou and
pablogsal
as code owners
April 7, 2026 17:23
pablogsal
reviewed
Apr 24, 2026
pablogsal
reviewed
Apr 24, 2026
| t = THEME() | ||
| error_prefix = f"{t.error}{error_prefix}{t.reset}" | ||
| self.console.beep() | ||
| self.msg = error_prefix + msg |
Member
There was a problem hiding this comment.
Maybe I am misreading this flow but if I am not wrong, the error() now embeds the escape sequences into self.msg. The message renderer at _render_message_lines slices by string length, not visible width. Then, len(message_line) counts the ANSI bytes (\x1b[1;31m ... \x1b[0m), so on narrow terminals (or long error messages) the slice boundary can land mid-escape, producing a truncated \x1b[ on one line and stray m on the next leaving the whole line un-colored or visually corrupted.
Member
Author
pablogsal
reviewed
Apr 24, 2026
Documentation build overview
19 files changed ·
|
johnslavik
force-pushed
the
enable-error-overlays
branch
from
July 20, 2026 22:55
1d02b0f to
8cb9bc0
Compare
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When you press Tab and nothing matches, the REPL now shows
! no matches, so you know why it did nothing:Screen.Recording.2026-04-07.at.19.04.58.mov
If a history search finds nothing, or Ctrl-Y has no cut text to insert, the REPL explains why. It also reports keys with no command assigned, so you can tell whether it understood your shortcut:
Screen.Recording.2026-04-07.at.19.08.58.mov
The REPL always created these messages, but they were discarded silently. This PR displays them temporarily below the input and asks the terminal to beep. The
!prefix is colored when color is enabled.I've made some opinionated choices on which messages should go through or not, e.g. moving past the start or end of the input stays silent because messages there would make ordinary editing distracting. As the issue notes, some messages still may need clearer wording, and accidental shortcuts can produce a message and beep. Any opinions on these would be very welcome (especially around how we present unknown shortcuts).
Tests cover messages, beep calls, colors, and line wrapping on narrow terminals, including text with color codes, wide characters, and combining accents.