mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #5066] [GUI] add a Reply width control: assistant prose is capped at 56ch, about 40% of the 864px column at 1440x920 #2354
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#2354
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 (Nov 3, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/5066
Area
[GUI] (the desktop app)
What do you want to do?
The user problem. In the desktop app, an assistant answer uses about 40 % of the width the window offers, and the rest of the window stays empty. It is not the model and not the window size: the answer's container is already full width, and one CSS rule caps the prose inside it at
56ch.On the window this app opens by default — 1440 × 920,
apps/desktop/src-tauri/src/main.rs:952(.inner_size(1440.0, 920.0),.min_inner_size(900.0, 600.0)) — the transcript column is 864 px wide and the prose is ~336–448 px. A 900-character Chinese answer becomes ~30 lines of ~30 glyphs; the right ~40 % of the window is blank, and every answer that happens to contain a table or a code block stretches to the full column, so the shape of a reply is decided by whether the model emitted a table.I want a Reply width control in Settings → Reading & focus, with three choices:
56ch, what it is today, kept as the choice for narrow windows and Latin prose;72ch(the top of the 45–75 character band the stylesheet itself targets);Stored in the existing prefs blob (
apps/host/src/lib/store.ts:147,strata.prefs.v2, the same placecontentFontSize,focusanddensitylive), applied asdata-measureon.app, and applied in Focus reading too (today focus mode pins the whole column tocalc(56ch + 72px), so the control has to reach that rule as well:app.css:466-470).I am not asking for the tables and code blocks to shrink: they are right at full width. I am asking for the prose to be allowed to join them, and for the default to be agreed in this issue before anyone writes a patch — CONTRIBUTING asks for exactly that for a change to a default.
Why this is not covered by the existing setting. Reading size changes the cap in proportion (it is
56ch, so the cap is 0.56 × the font's0advance × 56, and it scales with the text), which makes the text bigger, not the line reach the column; at 22 px the cap is ~672 px and the column is 864 px, so the gap never closes. Interface size is a rootzoom(app.css:4017-4020), so px andchscale together and the ratio is fixed. Focus reading narrows everything. Density only changes gaps (app.css:514-520). There is no width control to widen.Who needs it. People who read long technical answers, CJK readers, and anyone on a 1440 px and up display. For CJK the
chunit is not a neutral choice:chis the advance of the digit0(~0.556 em in the resolved face), so56chis ~30–32 Chinese glyphs — half of the 45–75 character band the stylesheet's own comment targets, and about half the width of the list items and tables in the same reply.What do you do today instead?
Nothing is available in the app: maximizing the window does not help (the 920 px column cap binds from ~1194 px of window width, and the 56ch cap binds inside it), the interface-size slider scales the ratio away, and Focus reading makes it narrower.
The workaround I actually use is to ask the model for the answer as a table, because a table is not capped (
app.css:4448-4452,.md-table{width:100%}) and prose is. That is a fair description of the current behaviour: the reply is as wide as its widest uncapped element.Evidence
All file:line references are
v0.2.10(ffa80d7), read from the source; the widths in the second table are measured on this machine as described below.The chain, from the window to the paragraph (read from the source):
apps/desktop/src-tauri/src/main.rs:952app.css:45--st-nav-w: 268pxapp.css:2385-2394.chat__inner{max-width:920px;padding:28px}app.css:2454-2456.st-msg--assistant{max-width:100%}(beats the kit's.st-msg{max-width:720px},kit/components.css:63, by import order:main.tsx:3-5)app.css:2457-2458width:100%;app.css:4418-4422padding-inline:0;app.css:4708border:0app.css:54--st-measure:56ch;app.css:483-485.st-msg--assistant .st-bubble :is(p, ul, ol, blockquote){max-width:var(--st-measure)}Markdown.tsx:89div.st-code, no capMarkdown.tsx:125div.md-table-wrap > table.md-table+app.css:4448-4452width:100%Markdown.tsx:94.md-math-block,.md-image,Markdown.tsx:101h2–h4, no capNothing in the React layer picks a width from the content:
Markdown.tsxemits bare<p>,<ul>,<ol>,<blockquote>for prose (:145,:114,:129, no classes), which is why the cap is a CSS descendant rule and the wide elements are simply the ones it does not name.Measured on this machine. Method:
System.Windows.Forms.TextRenderer.MeasureText(GDI, 96 dpi,TextFormatFlags::NoPadding) on 56 copies of0, in the face the app resolves to —Segoe UI, because--st-font-uinamesGT Walsheim Profirst and that face is licensed and not bundled (kit/tokens.css:12); Chinese glyph width measured the same way as a control (10 ×汉= 140 px at 14 px, i.e. 1 em).0(the cap)Two notes so this is not read as more precise than it is: GDI grid-fit quantises advances at small sizes, so a browser's float-advance layout puts 12 px nearer ~373 px than 336 px (0.556 em × 12 × 56); and the 864 px figure is CSS arithmetic, not a render. The app's own harness reproduces the same numbers in a browser:
apps/host/scripts/measure.mjs(npm run measure) measures characters-per-line of.st-msg--assistant .st-bubble pat 10/16/22 px, in normal and focus mode, andapps/host/tests/ui-do.test.mjs:228-237locks the current rule in.In-app reproduction.
用中文写一段约90字的段落,然后写三条长度相近的中文要点.Design intent, and where it runs out.
app.css:477-482states the intent and names the target: prose shares one measure, "Code blocks, tables and metric grids in the same bubble still use the full width, because a wide table is easier to read than a wrapped one", 45–75 characters per line, with 56ch chosen as ~66–68 real characters. That arithmetic is Latin-centric: for Chinese the same token is ~30 glyphs, and for a 1440 px window it is ~40 % of the column. A control keeps the intent for the people who want it and gives the rest their window back.Related. #4722 is the same cap: it reported that one reply used three text widths because the list half of the selector pointed at a class the renderer never emits (
.md-li,app.css:2470, dead). That landed —app.css:483now reads:is(p, ul, ol, blockquote)— and its effect is that lists are capped too, so what is left is this: prose and lists narrow, tables and code wide, with no way to choose. This issue is that follow-up; #4722's 460 px at 14 px in the shipped 0.2.8 matches the 448 px above.Strata version
Desktop app 0.2.10 (source
ffa80d7, tagv0.2.10), Windows 11 x64, UI language 中文, reading size 12 px as loaded (the prefs blob on this machine storescontentFontSize: 14without thesizeDefaultsmark, solib/default-sizes.ts:12-19resets it to 12 px on load).@xvcezrqpbxtpzblrt commented on GitHub (Nov 3, 2026):
For a Chinese answer, the full column is not "no measure" — it is the app's own 45–75 character target. Today's
56chis the one outside it.I read
app.css:49-54and:477-482first, and I am not arguing against a measure: 45–75 characters per line is right and the comment is explicit that code blocks and tables keep the full width on purpose. The problem is the unit, not the target.chis the advance of0, and0is 0.556 em in the resolved face:Measured on this machine (
TextRenderer,NoPadding, 96 dpi, faceMicrosoft YaHeifor CJK,Segoe UIfor Latin):10 × 汉 = 140 pxat 14 px → 1 Chinese glyph = 1.000 em;E-n= 0.583 em. So56chis ~66–68 Latin characters — inside 45–75, exactly as the comment says — and 28 Chinese characters, because the same token counts a Chinese glyph as half of one.56ch(measured)Three things follow from that table.
1. The narrow case is a bug in the unit, not a taste fight. The stylesheet's contract is 45–75 characters. A Chinese answer in a 1440 px window gets 28. Asking for
100%here is asking for 72 characters, which is inside the band the project set for itself. Nobody is asking to remove the measure; on Chinese, the full column is the only width that satisfies it.2. The frequent wrapping is the cost, in numbers.
line-heightis 1.62 (app.css:492). A 1000-Chinese-glyph answer:The window opens at 920 px (
main.rs:952). Today one ordinary answer is taller than the viewport and the eye makes 36 line returns to read it; at full width it is a third of a screen and 14 returns. The report from the person at the keyboard is "换行太快,看着难受" — that is this ratio, not impatience.3. Small text is the same token, twice.
default-sizes.ts:1-2sets the reading size to 12 px and the interface zoom to 90 % (11-01, from 14 px and 100 %), so prose reaches the screen at12 × 0.9 = 10.8 CSS px = 8.1 pt, and 10 px reaches 6.8 pt. Latin glyphs survive that; a Chinese glyph with 1.62 leading at 8 pt is at the legibility floor. Note also that the 11-01 change moved both levers the same way: at 14 px the cap was 448 px (32 chars), at 12 px it is 336 px (28 chars) — smaller text made the line shorter too.And the product already shows that the wide width reads. Every table and code block in the same answer is 864 px (
Markdown.tsx:125→app.css:4448-4452;Markdown.tsx:89), and #4722 is a report of people reading both widths in one bubble. The eye is not saved from scanning by the cap; it is given a new line length per block type.The proposal, so the Latin case is protected too. A 139-character Latin line is bad (
864 px / 0.583 em / 12 px ≈ 139), so the cap must be script-aware, not global — and the app already publishes the script:store.ts:472setsroot.langtozh-CN/ja/ko, andapps/host/src/styles/*.csscontains no:lang()rule today. So:56ch, unchanged.:lang(zh|ja|ko): Comfortable =max-width: min(100%, 45em)(45 glyphs = 540 px at 12 px, the bottom of the band), Full =100%; default Wide, Latin keeps Comfortable as the default.Reply widthcontrol from the issue body, with the CJK default on Wide.Cost is small and testable: one
:lang()block, one key instrata.prefs.v2, and the threshold intests/ui-do.test.mjs:228-237.scripts/measure.mjsalready measures characters-per-line of.st-msg--assistant .st-bubble pat 10/16/22 px, so it can assert 45–75 for each script — that is the check that would have caught the 28-character line. I am not sending a patch: the scope call is yours, and #4722 shows how fast these widths move when the target is written down.中文摘要(给作者):限宽的
56ch对拉丁文本 = 66–68 字,正好落在样式表自己写的 45–75 目标里;但ch是0的宽度(0.556 em),中文一个字是整整 1 em,所以同一份样式在中文上只有 28 字/行,低于自家目标 1.6 倍。1000 字的中文回答在 12px 下要 36 行、700px 高(窗口才 920px),通栏是 14 行、272px;这就是"一直换行"的来源。加上 12px 阅读字号 × 90% 缩放 = 屏上 8.1 磅,中文在 1.62 行距下已到可读性下限。建议按语言分开:拉丁保持 56ch,:lang(zh/ja/ko)用45em(舒适)到100%(通栏=72 字/行,正好在 45–75 内),默认宽版,并把设置项Reply width交给人。应用已经在store.ts:472写好了<html lang>,CSS 里现在没有任何:lang(),改动只有一条规则+一个偏好键+测试阈值。