mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #3818] [GUI] reply text cannot be fully selected, and single newlines in replies become paragraph breaks #1616
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#1616
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @xvcezrqpbxtpzblrt on GitHub (Oct 23, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/3818
2026-11-06 更新:换行部分已由 0.2.5 修复(Niko1221 2026-10-29 评论确认:段落内单个换行渲染为 soft break)。本 issue 只跟进回复文字不能完整选中/跨段复制会丢这一项。
Area
[GUI] (the desktop app)
Desktop app, Terminal or source?
Desktop app (Windows, Linux or Mac)
What happened
Two defects in the chat transcript, both reported by the person using the app on this machine. This report is based on that observation plus source inspection; no GUI automation was run against the app (see Reproduction status).
1. Reply text cannot be fully selected.
The person reports that they cannot select a whole reply (or a passage that spans messages) and then copy it: the selection does not extend as expected. There is no deliberate block - the transcript has no
user-select: none, noselectstart/copyhandler, and no Ctrl+A/Ctrl+C binding. The part of the UI that does not cooperate is the scroll behaviour: while a reply is streaming, the transcript is re-pinned to the newest token on every update, so the text moves under the pointer and the selection endpoint lands somewhere else. The report does not say whether the same drag also fails once the reply has finished; that distinction matters and is called out under Reproduction status.2. A single newline inside a reply is rendered as a paragraph break.
The Markdown renderer splits the answer on
\nand emits one<p>per non-empty line. A paragraph that the model soft-wrapped, or any text with one\nbetween two lines of the same sentence, is therefore shown as two paragraphs with a 10 px gap instead of one paragraph with a space where the newline was. This is deterministic and matches "the reply breaks the line where it should not".Expected: a completed or streaming reply can be selected end to end; a single newline inside a paragraph is a soft break (a space, as in CommonMark/GFM), and only a blank line starts a new paragraph.
Actual: the transcript jumps to the newest token while a reply streams, so a drag selection does not stay where it was started; and a single
\nproduces a visible paragraph break.Scope: the line-break rendering applies to every assistant reply that contains a single
\n. The selection problem is intermittent and appears to depend on whether a reply is streaming and on the scroll position.The message copy actions are a separate defect, already tracked in #3731. They are not re-reported here, but they are why the person cannot easily check whether the
\nis present in the raw reply (Copy responsecopiesm.content).Smallest steps or command that reproduce it
Line breaks:
Line one\nLine two(or let the model soft-wrap a long paragraph).Selection:
Reproduction status
Unconfirmed static analysis (I read code or ran a scanner; I did not see it fail)
The behaviour is reported by the person at the keyboard; the cause below is a suspected path read from the installed code, not an observed failure reproduced by the reporter. The renderer output is deterministic from the code.
Strata version
Strata 0.2.3 - engine 0.1.48
Graphics card, memory and system
RTX 3080 Ti Laptop 16 GB - 64 GB RAM - Windows 11 Pro 26H2 (10.0.26300.9711)
Model, size and settings
Not included: the report is about the transcript renderer and scroll behaviour, not the model. No conversation text is reproduced here.
Logs
No engine log: both defects are client-side.
The installed app is 0.2.3 in
%LOCALAPPDATA%\Programs\Strata.control/COMMITis5c8dd322528cc84f68f461ad54a506b9da8fa8d4, and thev0.2.3tag points at that commit. The source maps shipped inside the app (host/dist/assets/index-CQz2_JE-.js.map) containMarkdown.tsxandChat.tsxline-for-line identical to that commit, so the line numbers below are the code that is actually running.1. One
<p>per lineapps/host/src/components/Markdown.tsxat5c8dd32(permalink):const lines = text.split('\n');\n\nand\n\n\nproduce the same single gapnodes.push(<p key={i}>{tr(inline(line, onOpenLink, imageSession))}</p>);apps/host/src/styles/app.cssL2442-2444 (permalink):So
"one sentence\ncontinues here"becomes two<p>elements with a 10 px gap. The same loop also ends a list or blockquote at the first continuation line (L88-99, L111-115), so a wrapped list item becomes a paragraph outside the list.2. The transcript re-pins to the bottom on every token
apps/host/src/screens/Chat.tsxat5c8dd32:ResizeObserveron.chat__inner; whilepinned.currentis true it runsel.scrollTop = el.scrollHeighton every size change.scrollToLatest()setspinned.current = trueand callsel.scrollTo({ top: el.scrollHeight, behavior: 'smooth' }).session.messages.at(-1)?.contentcallsscrollToLatest()whenever the reader is within 120 px of the bottom.onScrollonly clearspinnedwhen the reader is more than 400 px from the bottom.A streamed token changes the last message's content, so L264-271 runs per token, and the
ResizeObserverfires on the resulting height change. Within the last 400 px the view is therefore pulled to the newest token continuously - the region where a reader starts a drag selection. There is no "pause follow while a selection exists" check:getSelection()is not called anywhere inapps/host/src.content-visibility: autoon.st-msg(app.cssL3961-3964) makes off-screen turns use estimated heights; the comments atChat.tsxL217-221 and L234-238 already acknowledge the resulting scroll drift. That is a secondary factor here: it can move content during a drag as turns render.3. Not a
user-selectblockThe only
user-select: nonerules are on the Tuning dial (app.cssL4916), the code line-number gutter (app.cssL5804), the diff gutter (app.cssL7245) and the preview resize handle (annotation-fixes.cssL596). Nothing on.st-msg,.st-bubble,.chatorbody.apps/host/src/lib/commands.tshas no Ctrl+A or Ctrl+C binding, so the WebView2 defaults apply.4. Copy is separate
The message copy actions still use a bare
void navigator.clipboard.writeText(...)with nocatch:Chat.tsxL623 (user message), L662 and L666 (assistant reply). That is #3731; it is a different defect and is not re-reported here.Duplicate search
Searched open and closed issues for
copy,clipboard,selection,select text,line break,newline,paragraph,markdown,white-space. The closest:white-space: pre-wrap. It does not cover a soft newline becoming a paragraph in an assistant reply, nor the selection behaviour.No issue covers the pair reported here.
Suggested fix (not tested)
Markdown.tsx, accumulate consecutive non-empty lines into one paragraph and join them the way CommonMark does (a space), and only start a new paragraph at a blank line. Keep headings, lists, tables, code and blockquotes as block boundaries. A CommonMark parser with soft breaks would give the same result.window.getSelection()not collapsed), or while the primary pointer is down inside the transcript, skipscrollToLatest()and theResizeObserverjump so the text does not move under the pointer.@Niko1221 commented on GitHub (Oct 29, 2026):
Thank you. The line-break part is fixed in 0.2.5: a single newline inside a paragraph is now a soft break (a space), and two spaces or a backslash still make a hard break. For the selection part: does it still happen on 0.2.7 once a reply has finished streaming, and is it the desktop app or the web chat page?
Release: https://github.com/Niko1221/Strata/releases/tag/v0.2.5
@xvcezrqpbxtpzblrt commented on GitHub (Oct 30, 2026):
Answering both questions from the shipped 0.2.8 code on this machine. This report is about the desktop app, not the served web chat page (they share this transcript code, so the same path applies to both).
Environment. Desktop app 0.2.8 (
%LOCALAPPDATA%\Programs\Strata, app0.2.8, Control and engine0.1.54), Windows 11 Pro build 26300, NVIDIA GeForce RTX 3080 Ti Laptop GPU 16 GB, 64 GB RAM. The reporter is the person at the keyboard; this is source inspection of the shipped 0.2.8 tree again, not a GUI-automated run, and each claim below says whether it is observed behaviour or read from code.The line-break half is fixed and I can confirm it is in 0.2.8.
Markdown.tsxnow accumulates consecutive lines into one paragraph and treats a single newline as a soft break:https://github.com/Niko1221/Strata/blob/v0.2.8/apps/host/src/components/Markdown.tsx#L131-L140
(
// One paragraph: a single newline inside it is a soft break (a space); two spaces or a backslash at the end of a line is a hard break (#3818)), shipped in v0.2.5 byc1e80f7. Thank you.The selection half is still present in 0.2.8, on the same path as reported:
https://github.com/Niko1221/Strata/blob/v0.2.8/apps/host/src/screens/Chat.tsx#L252-L255 — a
ResizeObserveron.chat__innerrunsel.scrollTop = el.scrollHeightwheneverpinned.currentis true.pinnedis released only by the reader's own wheel, touch, key or scroll input:https://github.com/Niko1221/Strata/blob/v0.2.8/apps/host/src/screens/Chat.tsx#L434-L441 through
followAfterScroll(https://github.com/Niko1221/Strata/blob/v0.2.8/apps/host/src/lib/follow-scroll.ts#L28-L32).
Dragging across text produces none of those events.
onPointerDown(same line 440) only stampsreaderInput.current; it does not clearpinned.Chat.tsxnorlib/follow-scroll.tscallsgetSelection()anywhere atv0.2.8, so "pause the follow while a selection exists" (the suggestion in the original report) has not been added.What did change since 0.2.3, and it is worth crediting: #4014 reworked the follow rule, so a wheel notch or
PageUp/ArrowUp/Homenow lets go of the stream at once instead of being pulled back inside the old 120 px band. That fixes the case of scrolling back to reread during a stream; it does not help a drag selection, because a drag is not one of the inputs that lets go.On "does it still happen once a reply has finished streaming": the 0.2.8 code says mostly yes at the moment it finishes, then no. When
m.streamingflips to false, three more blocks render below the text — the actions row,SkillsUsedand the deliverables cards:https://github.com/Niko1221/Strata/blob/v0.2.8/apps/host/src/screens/Chat.tsx#L669-L677
so
.chat__innergrows once more, and whilepinned.currentis still true the observer (L252-255) pulls the view down again — that lands exactly under a drag that started during the stream. After the turn is fully rendered and nothing else grows, the observer does not fire and a completed reply should select end to end. I have not yet hand-verified this on 0.2.8 at the keyboard; if it contradicts what the code says I will come back and correct this comment rather than leave it.Still open therefore: defect 1 of this issue (drag selection during and at the end of a streamed reply). Defect 2 (single newline as a paragraph break) can be considered resolved on 0.2.8.
Minimal fix, unchanged from the report: while
window.getSelection()is not collapsed, or while the primary pointer is held down inside the transcript, skip bothscrollToLatest()and theResizeObserverre-aim, and re-enable the follow when the selection is released. Nothing inlib/follow-scroll.tswould need to change shape for that.