Skip to content

merge: replace the default-on ellipsis tooltip with upstream #454's opt-in one - #64

Merged
xiaoyumuxi merged 9 commits into
mainfrom
sync/ellipsis-tooltip-opt-in
Nov 26, 2026
Merged

xiaoyumuxi merged 9 commits into
mainfrom
sync/ellipsis-tooltip-opt-in

Conversation

@xiaoyumuxi

Copy link
Copy Markdown

改了什么

把上游 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 一样,那一侧放不下时换到对面。方向和开关分开继承。
  • 每次绘制只查询一次指针下的 hint:原来每帧查了两次。
  • 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,合入后要换成 fork main 上的 merge commit。

为什么

fork main 要带的是上游即将合入的版本,否则 Lithe 依赖的是一个评审时已经被否掉的默认开启行为。以后同步上游时,这些文件也不会再因为两份不同的实现而冲突。

怎么验证的

macOS(Apple Silicon),在这个分支上:

  • test -z "$(gofmt -l $(git ls-files '*.go'))":通过。
  • go vet ./...:通过,只有 core_render.m 里原有的 didModifyRange: 弃用警告。
  • 平台 vet: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 个和上游 main 91da94a(已包含在 fork main 里)一样:
    • 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 相同。开不开、显示在哪一侧,由应用决定。

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.
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.
@xiaoyumuxi
xiaoyumuxi merged commit e86884c into main Nov 26, 2026
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant