Repository navigation
feat(ui): show the full text of an ellipsized label on hover - #61
Merged
Merged
Conversation
A label that Ellipsis cuts short hides the rest of its text with no way to read it. Layout now marks a text node it actually truncated, and painting registers a non-interactive hover hint for it (gfx.HoverHint: owner, bounds, full text, the control it belongs to, layer and clip scope). After the tooltip delay a Page shows the hint through the shared tooltip, the same one Tooltip uses. The hint adds no hit target, focus stop or accessibility node, so clicks, selection and keyboard behaviour are unchanged. It only appears when the layout really cut the text: a value that merely ends in an ellipsis does not trigger it. A clip, a hit painted later, a higher layer or a focus trap hides it; pressing the pointer hides it until the pointer leaves. Box.OverflowTooltip(text) lets a caller that shortened a value itself (a middle-elided path, say) hand over the original. Select, combobox, dropdown menu and hierarchy menu items, multi-select chips, table cells and area chart axis labels use the same path. Canvas Reset, Trim, Rewind, embedding and replay carry or clear the hints with the rest of the frame. The components that share the ellipsis helper now require label, so the installer templates and componentRequires are regenerated with componentgen.
24 of 27 tasks
xiaoyumuxi
added a commit
to 1lck/Lithe-IDEA
that referenced
this pull request
Nov 25, 2026
* feat(workbench): 省略文字悬停时显示全文 日志消息与字段、工具链路径、Git 日志、插件画布、状态栏文件名和信任对话框的省略文字, 鼠标停留后用共享提示显示完整内容。宿主提前缩短的文字通过 Viva 的 OverflowTooltip 传入原文,点击、行选择、筛选和复选框行为不变。 依赖 Viva 全文提示能力(Lithe-IDEA/Lithe-viva#61,上游 vivaui/viva#454), desktop/go.mod 的固定版本要在 fork PR 合入后再升级。 * test(workbench): 运行配置作用域标签按省略后的显示检查 打了全文提示补丁的 Viva 让 Select 的触发器在放不下时显示“…”,不再硬裁剪。 112 宽的作用域选择器里,“All configurations (3)”会显示成“All configuration…”。 新增 showsFitted:完整显示即通过;被省略时把指针停在标签上,检查提示里是完整的值。 * docs(agents): 记录下拉框改为省略显示,更新全文提示的矩阵说明 * perf(logwindow): 只给被截断且有高亮的消息加容器 日志消息原来每行都包一层 Row 来承载全文提示。现在只有消息被截断、又被搜索高亮 分成多段时才包这一层;其余消息直接在标签上登记提示,保持原来的节点结构。字段的 完整键值改为第一次被截断时拼接并随字段缓存。 补充高亮分段消息的悬停回归测试,修正截图说明里字段提示的描述,功能矩阵列出新测试。
This was referenced Nov 25, 2026
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.
Upstream: vivaui#454 (the same change on upstream
mainf6d52d5f). This branch is that commit cherry-picked onto the fork'smain(36cbd3ab), with two differences:gfx/pose.go. The one line upstream changes there, recordinglen(canvas.hoverHints)where a pose opens, is inPresence.applyingfx/presence.go.componentRequiresare regenerated on this base withgo run ./tools/componentgen.Lithe's ellipsis hover change was built and tested against a copy of this branch that differs from it only in
cmd/viva's generated installer templates, which Lithe does not import.On this branch, macOS (Apple Silicon):
test -z "$(gofmt -l $(git ls-files '*.go'))"go vet ./...(apart from the ignored localbuild/directory): clean apart from the existingdidModifyRange:deprecation warning.go vet -tags vivahead ./internal/platform/darwin ./headless/...;GOOS=windows,GOOS=linux(amd64)go vet ./internal/... ./app/;GOOS=js GOARCH=wasm go vet ./internal/platform/web/ ./app/.go test ./... -count=1: 131 packages pass.cmd/vivafails: its 14 packaging tests report "the program was built for macOS 13.0 or later but [mac] min_system says 12.0", from the macOS 27 SDK's deployment target. The same 14 fail on36cbd3abwithout this change.TestGeneratedRecipesAreCurrentandTestInstalledRecipesMatchReferenceSourcepass.The benchmarks and binary size below were measured on the upstream branch.
What this changes
A label that
Ellipsiscuts short now shows its full text in the shared tooltip when the pointer rests on it.base:textTruncated). Painting registers a hover hint for it, and only for it: a value that merely ends in…does not get one.Box.OverflowTooltip(text)lets a caller that shortened a value itself (a middle-elided path, say) hand over the original. With it the hint is registered whenever the box paints text, since the caller already decided the value is shortened.Page.HoveredText()returns the hint under the pointer;Page.PointerDown()reports a press.gfx:gfx.HoverHintholds the owner, bounds, full text, the control it belongs to, layer and clip scope.Canvascollects hints with the rest of the frame.HoverHintAtreturns the topmost hint at a point. It skips a hint covered by a hit painted later on another control, by a higher layer, or outside a focus trap. A hit of the control the hint belongs to, and container and label hits, do not hide it.Reset,Trim,Rewind, embedding and replay carry or clear the hints the same way they treat hits.ui: afterTooltipDelay,Pageshows the hint throughcomponents.BeginTooltip, the tooltipTooltipalready uses. A press hides it until the pointer leaves the text, so it does not cover a selection or a drag.components: Select, Combobox, Single Select, dropdown menu and hierarchy menu items, Multi Select chips and area chart axis labels go through one helper (labelEllipsis, inlabel.go), so each gets the hint. Those components now requirelabel; the installer templates andcomponentRequiresare regenerated withgo run ./tools/componentgen. Table cells, which shorten their values themselves, register the hint with the full value where the drawn text differs from it.Label, which clips at the bounds with no ellipsis. They now end a value that does not fit with…, as the other components already did, and show it in full on hover. Code or tests that read a narrow Select's drawn text get the shortened value: in Lithe, "All configurations (3)" in a 112pt-wide trigger now reads "All configuration…".The hint adds no hit target, focus stop or accessibility node. Clicks, selection, keyboard behaviour and the accessibility tree are unchanged.
Why
Lithe (1lck/Lithe-IDEA) shows commit subjects, paths, toolchain locations and plugin canvas text in places too narrow for them.
Ellipsiscut them with no way to read the rest. Each control adding its ownTooltipwould need a hit target per label and its own idea of when text is cut, which only layout knows. A non-interactive hint keyed to the truncation layout already measured gives every ellipsized label the same behaviour.How it was verified
test -z "$(gofmt -l $(git ls-files '*.go'))"go vet ./...on macOS: clean apart from the existingdidModifyRange:deprecation warning incore_render.m.go vet -tags vivahead ./internal/platform/darwin ./headless/...;GOOS=windows,GOOS=linux(amd64)go vet ./internal/... ./app/;GOOS=js GOARCH=wasm go vet ./internal/platform/web/ ./app/.go test ./... -count=1on macOS (Apple Silicon): 137 packages pass. The 4 that fail fail the same way onf6d52d5fwithout this change:cmd/viva: the packaging tests report "the program was built for macOS 13.0 or later but [mac] min_system says 12.0", from the macOS 27 SDK's deployment target.TestGeneratedRecipesAreCurrentandTestInstalledRecipesMatchReferenceSourcepass.internal/componentdemo,internal/gallery,ui/inputnumber: input-number's warm paint allocates once.New tests:
ui:TestEllipsisTooltip,TestEllipsisTooltipWithoutAHit,TestEllipsisTooltipClippingAndExistingHint,TestMaxLinesTooltipAndLiteralEllipsis,TestOverflowTooltipKeepsCheckboxCaptionClickablegfx:TestHoverHintFollowsReplayAndRewind,TestHoverHintIsMountedAndClippedWithEmbeddedTextui/multiselect:TestEllipsizedChipKeepsItsFullLabelAndRemoveButtonThey use the new API and do not build on
f6d52d5f.Benchmarks before and after, macOS Apple Silicon, 5 runs each,
-benchtime 200ms, median ns/op. The machine was not idle; the differences are within run-to-run noise. allocs/op are unchanged.Binary size:
cmd/showcase, darwin/arm64,-trimpath -ldflags='-s -w': 7661794 → 7694850 bytes (+33 KB, +0.43%).Not checked in a real window on any platform. No platform backend changed; the tooltip is drawn by the existing
BeginTooltippath.Reaching the frame
Headless (
-tags vivahead): aLabelwithEllipsisin a box narrower than its text, pointer moved onto the text, clock advanced pastTooltipDelay.TestEllipsisTooltipdoes exactly this and checks the tooltip's text; the same test with the box wide enough checks that no tooltip appears.Cost
HoverHintappended per truncated label per paint, into a slice the canvas reuses, so a warm frame allocates nothing more (see the allocs/op column).