Repository navigation
merge: replace the default-on ellipsis tooltip with upstream #454's opt-in one - #64
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.
Showing the complete value of shortened text changed every existing app, since every Ellipsis and MaxLines text grew a hover tip. It is now off by default, as Arco's ellipsis.showTooltip is: PageConfig.EllipsisTooltips turns it on for a page and Box.EllipsisTooltip(on) turns it on or off for an element and what it holds, the nearest one winning. A Popup follows the element it hangs off, or the element it was declared in when it is placed by a rectangle or a point. Components see the setting as the canvas's hover hint owner, which stays zero where the tooltips are off, so Table cells, menu items and chips register no hint there. Select keeps clipping its value at the bounds, as before, unless the tooltip can show the rest. A Memo redeclares when the setting it was painted under changes. OverflowTooltip is the caller's own opt-in and keeps working on any page. The documentation says what keyboard and screen reader users get: only the pointer shows the tip, and a control keeps its complete name and value in the accessibility tree whatever its drawing shortens. Over the text, the tip takes the place of the Tooltip of the element the text is in.
A page asks for the hint under the pointer once a frame. The benchmark measures a table whose every row is a hit holding shortened text, with the pointer on the first row's text (every hint and every later hit is walked), beside the text (every hint), and with the tooltips off (no hints).
PaintChild checks for an EllipsisTooltip before painting an element, and the check does not inline, so every element paid one more call. The child loop, which paints nearly every element, now checks the setting itself and calls paintElement directly; only an element that sets it goes through paintWithEllipsisTip. PageFleet's median went from +5.5% to +1.6% over main.
A page looked up the hint under the pointer twice per paint: the tooltip painter asked HoveredText during End, and paintOnce asked again after End to store it, with the same result both times since the tooltip declares no hits. End now stores the lookup before it paints the tooltip, a pointer event stores its own, and HoveredText returns the stored hint.
The tooltip of shortened text always opened below the text, which hides the rows under a list and does not fit a status bar along the window's bottom. Box.EllipsisTooltipOn(side) opens the tooltips of the shortened text in an element and what it holds beside side, as TooltipOn does for a Tooltip: those EllipsisTooltip shows and those OverflowTooltip gives. It does not turn them on. The nearest one decides, and a Popup follows it as it follows EllipsisTooltip. Without room on side, a tooltip opens on the opposite one. The element keeps the switch and the side in its one ellipsisTip byte, the frame tracks both while painting, and the canvas stamps the side on each hint, which the shared tooltip reads.
The benchmark said a query over the first row's text was the worst case because it passed only the hits painted after the row. It passes every hit whatever the row, since a hit painted before the text on a higher layer still covers it. Name the case "on a row's text" and say so.
…'s opt-in one Fork #61 took an early copy of vivaui#454 (2a19490) that showed the complete value of every shortened text. Review made it opt-in, and the branch has since gained EllipsisTooltipOn, one hover hint lookup per paint and a HoverHintAt benchmark. This merges the branch at 1397af6 and drops 2a19490's version of the same files in favour of it, so the fork carries what upstream will. The only fork change in those files, PageConfig.BarStyle, stays. A page that relied on the default-on tooltip now sets PageConfig.EllipsisTooltips.
19 of 25 tasks
xiaoyumuxi
added a commit
to 1lck/Lithe-IDEA
that referenced
this pull request
Nov 26, 2026
…ontent (#2440) Viva's full-text tooltip for text cut short with an ellipsis is now off by default (upstream vivaui/viva#454) and opens on a side a container chooses. - Pin Viva to fork PR Lithe-IDEA/Lithe-viva#64 head 600e6846 until it merges into fork main. - Turn the tooltips on in the PageConfig of the main window, the settings window and the log window, and in the plugin view test pages. - Open them toward the editor from tool windows (right from the left slots, left from the right slots, above from the bottom area), above from the status bar, and to the right from the settings and log window sidebars, so they no longer cover the next rows of a list. - Test the side in each region, capture each region in both themes and both languages, and update the agent note, the feature matrix entry and the screenshot README.
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.
改了什么
把上游 vivaui#454 的最新版本(
feat/ellipsis-hover-full-text,1397af69)合进 fork 的main,替换 #61 合入的早期版本(2a19490f)。#61 合入的是评审前的版本:所有被截断的文字都显示完整内容的 tooltip,而且只能显示在文字下方。vivaui#454 按评审改过之后,这个分支多了以下内容:
PageConfig.EllipsisTooltips整页开启,Box.EllipsisTooltip(on)对一个元素和它里面的内容开启或关闭,离得最近的设置生效。弹出层跟随它挂靠的元素,用矩形定位的跟随声明它的元素。Memo记录开关,开关变了会重新声明。OverflowTooltip是调用方显式给的,仍然任何页面都生效。Box.EllipsisTooltipOn(side):指定 tooltip 显示在上、右、下、左哪一侧,和TooltipOn一样,那一侧放不下时换到对面。方向和开关分开继承。BenchmarkHoverHintAt,以及绘制路径的内联修正(a7d30ae9)。合并方式:这是一个 merge commit(600e6846),没有 rebase,也没有 force push。和 2a19490 冲突的 15 个文件,以及 2a19490 改过的其余文件,都先撤掉 2a19490 的改动,再三方合并分支的版本(基准是上游 91da94a)。这些文件里 fork 自己的改动只有
PageConfig.BarStyle(#13),已经保留。合并后,这 37 个文件除base/page.go多了BarStyle外,和上游分支完全一样。对 Lithe 的影响:原来默认开启,现在必须显式开启。Lithe 要在工作台、设置窗口、日志窗口三个
PageConfig里加上EllipsisTooltips: true,并按区域设置EllipsisTooltipOn。这部分改动在 Lithe 单独的 Draft PR 里,固定版本暂时指向这个 PR 的头部 commit,合入后要换成 forkmain上的 merge commit。为什么
fork
main要带的是上游即将合入的版本,否则 Lithe 依赖的是一个评审时已经被否掉的默认开启行为。以后同步上游时,这些文件也不会再因为两份不同的实现而冲突。怎么验证的
macOS(Apple Silicon),在这个分支上:
test -z "$(gofmt -l $(git ls-files '*.go'))":通过。go vet ./...:通过,只有core_render.m里原有的didModifyRange:弃用警告。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:155 个包通过。失败的 4 个和上游main91da94a(已包含在 forkmain里)一样:cmd/viva:打包测试报 "the program was built for macOS 13.0 or later but [mac] min_system says 12.0",来自 macOS 27 SDK 的部署目标。internal/componentdemo、internal/gallery、ui/inputnumber:input-number 的热绘制会分配 1 次。HoverHintAt基准和二进制体积在上游分支上测过,见 feat(ui): show the full text of an ellipsized label on hover vivaui/viva#454 的描述。这个合并没有改变那些文件里的代码(只多了BarStyle字段)。边界
框架能力,和 vivaui#454 相同。开不开、显示在哪一侧,由应用决定。