Checklist
Reproduced on 0.73.4; the code path below is unchanged in main (0.74.2).
Steps to reproduce
- Start an agent shell, send a prompt, wait for the response.
- At the prompt, type:
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.
Checklist
Reproduced on 0.73.4; the code path below is unchanged in
main(0.74.2).Steps to reproduce
C-aonsecond 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 lineis not reachable with<up>at any goal column.Cause
agent-shell-chat-mode.el:297There are two newlines between a response and the prompt.
keep-termgives back one — the response's terminator — but the second one terminates the blank line, and stays covered. That blank line is then wholly inside theMeoverlay'sdisplay ""run, so it has no screen presence.adjust_point_for_propertywill not leave point inside such a run, and for an empty display string moving backward it goes tobeg - 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-testinserts the real"\n\n"layout but only asserts the first terminator is uncovered, so it passes either way.Possible fix direction
Starting the
Meoverlay at the prompt'sline-beginning-positionwould 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.