Fix chat prompt jumping and indentation - #802
Open
nhojb wants to merge 2 commits into
Open
Conversation
The live prompt's marker was carried as a `line-prefix' on the overlay hiding the comint prompt. A `line-prefix' is resolved once, at the position a display row starts from, and that row starts on a prompt whose every character is replaced by a `display' of "". Redisplay paths that resolve it a position later -- at the first character of the input, past the overlay -- find nothing and paint the row flush left, which shows as the input jumping sideways for a frame on each keystroke. Render the marker as the `display' replacing the prompt text instead, so it is part of the row and there is no prefix left to lose. This also settles the prompts that were rendering flush left for good: one after a code block panel, or at the start of a fresh shell, has no newline above for the `Me' label to ride, so the label falls back to a `before-string' whose trailing newlines moved the row start into the string itself. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Both the live prompt and a submitted turn indented the lines under the first but not the first itself, so a multi-line prompt read as ragged either way. While composing, only the first line was indented, by the marker: the overlay carrying it covers the prompt text alone, so no later row's start ever sees it, and a typed newline began a row outside it. Carry the body indent on a rear-advancing overlay over the draft itself, which is in place before anything is typed and takes in what follows, since no relabel runs per keystroke. A draft ending in a newline has no character at all on its last row (that row starts at end of buffer, past the overlay) for a `line-prefix' to hang off, so the caret sat flush left until the next character: an `after-string' stands in there meanwhile, kept in step by the draft's own modification hooks. Once submitted, the turn kept the indent on those same lines but not on its first, whose row starts on the hidden prompt. Display the body indent in place of that prompt's text, as the live prompt displays the marker, so the whole turn lines up with the response below it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
nhojb
force-pushed
the
fix/chat-prompt-alignment
branch
from
August 25, 2026 11:44
b36cd83 to
17a696b
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.
Fixes a couple of issues with the shell prompt:
Note: Running the latest
agent-shellin emacs 31.1First line jumping
Screen.Recording.2026-08-25.at.10.25.15.mov
Indentation (fixed)
Checklist
M-x checkdocandM-x byte-compile-file.