Skip to content

chat mode: <up> skips the first line of a multi-line prompt draft #786

Description

@OSadovy

Checklist

  • I agree to communicate with the author myself (not AI-generated).
  • I've read the README's Filing issues section.
  • I'm running the latest versions (fill in below).
    • agent-shell version: 0.73.4
    • acp.el version: 20260803.2034
    • ACP package (e.g. claude-agent-acp) version: claude-agent-acp 0.70.0
    • Agent CLI (e.g. claude, gemini) version: claude 2.1.234
  • For requesting new agent support, I'm including a link to the ACP-capable agent or related ACP package.
  • For issues, I'm including ACP traffic (as per README).

Reproduced on 0.73.4; the code path below is unchanged in main (0.74.2).

Steps to reproduce

  1. Start an agent shell, send a prompt, wait for the response.
  2. At the prompt, type:
    first line
    
    second line
    
  3. C-a on second line, then <up> <up>.

Expected: the blank line, then first line.

Actual: the blank line, then the end of the agent's last response line. first line is not reachable with <up> at any goal column.

Cause

agent-shell-chat-mode.el:297

(start (if keep-term (1+ raw-start) raw-start))

There are two newlines between a response and the prompt. keep-term gives back one — the response's terminator — but the second one terminates the blank line, and stays covered. That blank line is then wholly inside the Me overlay's display "" run, so it has no screen presence.

adjust_point_for_property will not leave point inside such a run, and for an empty display string moving backward it goes to beg - 1: the character before the whole run, which is the end of the response line two lines up.

Same reasoning as the comment at line 283, one newline further along.

agent-shell-chat-me-keeps-response-terminator-test inserts the real "\n\n" layout but only asserts the first terminator is uncovered, so it passes either way.

Possible fix direction

Starting the Me overlay at the prompt's line-beginning-position would keep the blank line a real line.

That alone would let surplus blank lines through — across 8 shells here the overlay covers 1, 3 and 6 newlines — so collapsing the surplus may want a separate run above the kept blank line rather than extending this one.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions