Mark restored prompts with comint-highlight-prompt - #794
Merged
Conversation
A user_message_chunk replayed during session/load renders a prompt prefix that, by its own comment, means to match the field/face shape comint emits for a live prompt. It carried agent-shell-prompt alone. That face inherits comint-highlight-prompt so it looks right, but shell-maker--re-search-forward-prompt tests for the symbol with memq, and inheritance does not satisfy it. The restored interaction is then missing from shell-maker--extract-history, so agent-shell-interaction-at-point returns nil, and agent-shell-viewport-refresh guards its whole body on that value: C-c C-o silently leaves the previous interaction on screen rather than showing the one under point. No error, no clue. Appended rather than substituted, so agent-shell-prompt stays first for precedence and remains available to customize. Downstream packages that match on it with memq keep working.
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.
Thank you for contributing to agent-shell!
Checklist
M-x checkdocandM-x byte-compile-file.The bug
After restoring a session,
C-c C-oon a restored interaction silentlyshows the previous one in the viewport. No error, nothing in
*Messages*.Why
agent-shell.el:3011renders the prompt prefix for auser_message_chunkreplayed during
session/load. Its own comment says it means to match thefield/face shape comint emits for a live prompt, but it applies
agent-shell-promptalone.That face inherits
comint-highlight-prompt, so the prompt lookscorrect. But
shell-maker--re-search-forward-promptmatches with(memq 'comint-highlight-prompt (ensure-list ...)), and inheritancedoesn't satisfy
memq. The restored interaction never entersshell-maker--extract-history, soagent-shell-interaction-at-pointreturns nil — and
agent-shell-viewport-refreshguards its entire body onthat value, so it does nothing at all.
Same applies to
session/push, which goes through the same branch.The fix
Append the face rather than substitute it.
agent-shell-promptstays first for precedence and remains customizable,and downstream packages matching on it with
memq(there are tsome) keep working.Verified
Against
shell-maker--re-search-forward-prompton the rendered prompttext:
No tests added since I think the change is trivial, but happy to add one. The existing suite
passes.