fix(ui): Fix Long Word/Function Name Truncation in Assistant Messages & Reasoning Body修复助手消息和思考过程中长词/函数名显示截断问题#6298
Open
SauronSkywalker wants to merge 1 commit into
Conversation
SauronSkywalker
force-pushed
the
fix/text-overflow-long-words_20260710_170500
branch
from
July 18, 2026 02:40
d070b0b to
e7a0f11
Compare
…& reasoning body Add word-break: break-word and overflow-wrap: anywhere to .md (markdown prose container) and word-break: break-word to .reasoning__body / .turn-collapse__inline-reasoning to ensure long continuous strings (e.g. model-generated function names without spaces) correctly wrap instead of being clipped by overflow-x: hidden. - Desktop (Windows/macOS/Linux): styles.css - .md + .reasoning__body - Web server: index.html - .reasoning__body
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request: Fix Long Word/Function Name Truncation in Assistant Messages & Reasoning Body
Pull Request:修复助手消息和思考过程中长词/函数名显示截断问题
Summary / 概述
Problem: When the model generates a long continuous string with no spaces or hyphens — such as a very long function name — the text overflows the container width. On the desktop client, the
.transcriptcontainer hasoverflow-x: hidden, which clips the overflowing text, making it appear truncated. The root cause is missing CSSword-break/overflow-wrapproperties on the Markdown prose container (.md) and the reasoning body (.reasoning__body).问题现象: 当模型生成了一个没有空格或连字符的极长连续字符串(如超长函数名时),文本会超出容器宽度。桌面客户端的
.transcript容器设置了overflow-x: hidden,超出的文本被直接裁剪,看起来像是被截断了。根本原因是 Markdown 正文容器(.md)和思考过程容器(.reasoning__body)缺少 CSS 的word-break/overflow-wrap属性。Fix: Add
word-break: break-wordandoverflow-wrap: anywhereto the.mdCSS class, andword-break: break-wordto the.reasoning__body/.turn-collapse__inline-reasoningCSS class. These properties tell the browser to break a word at any character when it would otherwise overflow its container.修复方案: 在
.mdCSS 类上添加word-break: break-word和overflow-wrap: anywhere,在.reasoning__body/.turn-collapse__inline-reasoningCSS 类上添加word-break: break-word。这些属性告诉浏览器当单词超出容器宽度时,可以在任意字符处断开。Files Changed / 修改的文件
1.
desktop/frontend/src/styles.cssPlatform: Desktop app — Windows (WebView2), macOS (WKWebView), Linux (WebKitGTK)
平台: 桌面应用 — Windows (WebView2)、macOS (WKWebView)、Linux (WebKitGTK)
Change A —
.md(Markdown prose container).md { font-family: var(--font-content-family); font-weight: var(--font-weight-regular); + word-break: break-word; + overflow-wrap: anywhere; }Purpose: All assistant message content is rendered through the
Markdown→MarkdownRenderer→ReactMarkdownpipeline, which produces<div class="md"><p>...</p></div>. Withoutword-break, long continuous text in wrapped<p>elements overflows themax-width: var(--maxw)constraint and gets clipped by the parent.transcript { overflow-x: hidden }.目的: 所有助手消息内容都通过
Markdown→MarkdownRenderer→ReactMarkdown管线渲染,生成<div class="md"><p>...</p></div>结构。没有word-break时,<p>元素中的长连续文本会超出max-width: var(--maxw)限制,被父容器.transcript { overflow-x: hidden }裁剪。Change B —
.reasoning__body/.turn-collapse__inline-reasoning.reasoning__body, .turn-collapse__inline-reasoning { overflow: hidden; ... white-space: pre-wrap; + word-break: break-word; }Purpose: The model's reasoning/thinking text also uses
white-space: pre-wrapwithoverflow: hiddenbut had noword-break. A long function name in the thinking section would overflow and be hidden by the container'soverflow: hidden.目的: 模型的思考/推理文本也使用了
white-space: pre-wrap+overflow: hidden,但缺少word-break。思考部分中的长函数名会超出并被overflow: hidden隐藏。2.
internal/serve/index.htmlPlatform: Web UI (standalone single-page application served via internal HTTP server)
平台: Web 界面(自包含单页应用,通过内部 HTTP 服务器提供)
Change —
.reasoning__bodyNote: The
.msg__textclass in this file already hadword-break: break-word(used for both user and assistant message text). Only the reasoning body was missing this property.注意: 该文件中的
.msg__text类已经包含word-break: break-word(用户和助手消息文本共用)。只有思考过程容器缺少此属性。Why These CSS Properties / 为什么选择这些 CSS 属性
word-break: break-word.msg--user .msg__textstyle; handles the general case welloverflow-wrap: anywhereword-breakalone might not sufficeword-break: break-word.msg--user .msg__text样式一致,通用性好overflow-wrap: anywhereScope of Impact / 影响范围
.md).reasoning__body)overflow-x: hiddenword-break(.msg__text)wrapAnsi)Not affected: Code blocks rendered via
CodeViewer(they have independent scrollbars), inline code spans (.md-code), and the CLI/TUI (which usesansi.Wrapto hard-break long words).不受影响: 通过
CodeViewer渲染的代码块(有独立滚动条)、内联代码片段(.md-code)以及 CLI/TUI(使用ansi.Wrap硬断长词)。windows desktop修复测试(其他客户端没条件没测,理论上mac等也可以正确换行)

修复前(过长被截断)
修复后(正确换行)
