Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(chat): keep stream cursor out of nested list boxes

vastsa10365d93dd3c
diff --git a/apps/desktop/src/styles/messages.css b/apps/desktop/src/styles/messages.css
index 76d26cdab..e23b61edb 100644
--- a/apps/desktop/src/styles/messages.css
+++ b/apps/desktop/src/styles/messages.css
@@ -3288,8 +3288,8 @@
.assistant-turn-fragment.smooth-cursor .prose-chat > :last-child:not(ul):not(ol):not(blockquote):not(pre):not(table):not(.table-wrap)::after,
.assistant-turn-fragment.smooth-cursor .prose-chat > :is(ul, ol):last-child li:last-child:not(:has(ul, ol)):not(:has(p))::after,
-.assistant-turn-fragment.smooth-cursor .prose-chat > :is(ul, ol):last-child li:last-child > :last-child::after,
-.assistant-turn-fragment.smooth-cursor .prose-chat > blockquote:last-child > :last-child::after,
+.assistant-turn-fragment.smooth-cursor .prose-chat > :is(ul, ol):last-child li:last-child > p:last-child::after,
+.assistant-turn-fragment.smooth-cursor .prose-chat > blockquote:last-child > p:last-child::after,
.assistant-turn-fragment.smooth-cursor .prose-chat > pre:last-child > code::after {
content: "";
display: inline-block;
@@ -3304,8 +3304,8 @@
@media (prefers-reduced-motion: reduce) {
.assistant-turn-fragment.smooth-cursor .prose-chat > :last-child:not(ul):not(ol):not(blockquote):not(pre):not(table):not(.table-wrap)::after,
.assistant-turn-fragment.smooth-cursor .prose-chat > :is(ul, ol):last-child li:last-child:not(:has(ul, ol)):not(:has(p))::after,
- .assistant-turn-fragment.smooth-cursor .prose-chat > :is(ul, ol):last-child li:last-child > :last-child::after,
- .assistant-turn-fragment.smooth-cursor .prose-chat > blockquote:last-child > :last-child::after,
+ .assistant-turn-fragment.smooth-cursor .prose-chat > :is(ul, ol):last-child li:last-child > p:last-child::after,
+ .assistant-turn-fragment.smooth-cursor .prose-chat > blockquote:last-child > p:last-child::after,
.assistant-turn-fragment.smooth-cursor .prose-chat > pre:last-child > code::after {
animation: none;
opacity: 0.7;
diff --git a/apps/desktop/test/chat-streaming-layout.test.mjs b/apps/desktop/test/chat-streaming-layout.test.mjs
index e44b9f6df..f941199f9 100644
--- a/apps/desktop/test/chat-streaming-layout.test.mjs
+++ b/apps/desktop/test/chat-streaming-layout.test.mjs
@@ -31,15 +31,16 @@ test("streaming prose chat stabilizes line wrapping against orphan-rebalancing r
});
test("streaming cursor attaches to inline leaf blocks and list items instead of container lists", () => {
- // List cursor must be placed on the last li / last li's child to prevent orphan line boxes under ul/ol
+ // List cursor must be placed on inline content, never on nested ul/ol containers.
assert.match(
messagesCss,
/\.assistant-turn-fragment\.smooth-cursor \.prose-chat > :is\(ul, ol\):last-child li:last-child:not\(:has\(ul, ol\)\):not\(:has\(p\)\)::after/,
);
assert.match(
messagesCss,
- /\.assistant-turn-fragment\.smooth-cursor \.prose-chat > :is\(ul, ol\):last-child li:last-child > :last-child::after/,
+ /\.assistant-turn-fragment\.smooth-cursor \.prose-chat > :is\(ul, ol\):last-child li:last-child > p:last-child::after/,
);
+ assert.doesNotMatch(messagesCss, /li:last-child > :last-child::after/);
assert.match(
messagesCss,
/\.assistant-turn-fragment\.smooth-cursor \.prose-chat > :last-child:not\(ul\):not\(ol\)/,
diff --git a/docs/spec/04-ux/09-interaction-patterns.md b/docs/spec/04-ux/09-interaction-patterns.md
index 496b77a02..db8e67f94 100644
--- a/docs/spec/04-ux/09-interaction-patterns.md
+++ b/docs/spec/04-ux/09-interaction-patterns.md
@@ -653,7 +653,10 @@ may be retained while exactly one workspace supplies the visible shell context.
approaches the viewport; thinking disclosures always retain Mermaid source.
- Diagram render failure or the 20,000-character / 500-edge safety limit keeps
the source visible and copyable instead of failing the assistant turn.
-- Cursor indicator: subtle pulsing accent dot or line at the end of streaming content
+- Cursor indicator: subtle pulsing accent line at the end of streaming inline
+ content. For Markdown lists and quotes, attach it to the terminal paragraph
+ or text leaf; never append it to a nested list container, which creates an
+ extra line box and shifts content while the response streams.
- Before the first assistant or tool event, the active turn shows one compact
localized `Working…` status with elapsed time. When the runtime reports a
quiet interval, that same row names the wait: starting, waiting for the
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index c1eb88c8d..c23373fa3 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -6013,6 +6013,9 @@ must keep splitting are covered by `markdown-blocks.test.mjs`.
jump-to-latest appears as soon as follow mode is released.
- On send, the transcript re-pins, hides jump-to-latest, and jumps to the bottom so the new user message (and following stream) is visible.
- Streaming continues to follow while pinned.
+ - Long Markdown responses with nested lists keep their list container line
+ boxes stable during streaming; the cursor follows the terminal inline text
+ without adding a blank line below a nested list.
- Manual scroll mid-stream pauses follow and shows jump-to-latest again; clicking it resumes follow.
- **Specs linked**: `04-ux/08-component-spec.md`, `04-ux/09-interaction-patterns.md`
- **Acceptance**: C (chat stream), Quality / D151