Skip to content

merge: bring the window, menu and markdown patches onto main - #11

Merged
1lck merged 11 commits into
mainfrom
feat/1799/main-with-fixes
Nov 12, 2026
Merged

1lck merged 11 commits into
mainfrom
feat/1799/main-with-fixes

Conversation

@1lck

@1lck 1lck commented Nov 12, 2026

Copy link
Copy Markdown

为什么

main 上一直没有 Lithe 固定的那 6 个 fork 补丁(Window.SetTitle、Config.OnFocusLost、ui.MenuAt、MarkdownView 图片、改标题后红绿灯居中、MenuItems.Beside),它们只在 fix/list-follow-end 那条线上(也就是 v0.6.1-0.20261111102951-7850516be532 指向的提交)。#10 是基于 main 做的,合并后 main 缺这些补丁,Lithe 侧一提升 pin 就编译失败。

本 PR 把那条线合进 main,让 main 同时带上 6 个补丁和 #10 的控件扩展,Lithe 可以重新只固定一个提交。

冲突处理

只有 ui/list.go 冲突:两边都在修“列表请求的滚动要在同一帧生效”。

  • 一边是 if end := max(...); end != scroll.Offset { ... } 的带变更判断写法
  • 另一边(main)是 snapScroll 吸附整像素并把 offset 写回布局节点

取 main 的写法:它同时满足两边意图(既在同一帧显示请求的终点,又保住字形纹理),且下方 bottom := offset + viewport 读的就是同一个 offset。

验证

  • go build ./... 通过
  • go test ./ui/ ./components/ ./gfx/ 通过

xiaoyumuxi and others added 11 commits November 11, 2026 13:33
listArea declared its ScrollArea, which takes the offset the state had, and
applied ScrollTo, ScrollIntoView or ScrollToEnd only afterwards. The rows
were placed for the new offset while the layout still scrolled the area by
the old one, so the paint that applied a far request showed the rows out of
view: a blank list until something else repainted it. ScrollAt already
writes the offset to the node for this reason; the List now does the same.

A request past the end is brought only as far as the rows go, and
ScrollToEnd places the last rows, so neither needs a second paint either.
macOS sets the NSWindow title on the main thread; Windows posts the change to
the window thread and applies it with SetWindowTextW (a direct call from
another thread would block on WM_SETTEXT); Linux sets the GTK toplevel title
on the GTK thread; the headless host records it in its windows listing.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Native windows already hear the loss of focus to release held keys; the
application now hears it too, after the release, so it can save or hide
what only makes sense while the window has the user's attention.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
For a menu the application opens itself where no control stands for it,
such as a mark painted inside a custom-drawn view. It looks and behaves
as a ContextMenu.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The parser makes ![alt](destination) a Span whose Image is the
destination as written. MarkdownStyle.Image asks the application for
each image's bitmap; the view lays it out inline, scaled down to the
column and never up, makes a line as tall as its tallest image, keeps a
linked image a link, and paints it. Without a bitmap the alt text shows,
as before. The framework never reads files or the network.

Closes the need of vivaui#220 in this fork.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Setting the window title lays the titlebar out again, and AppKit puts the
zoom button back at the system's height without posting the frame change
keepTrafficLightsCentered listens for. In a custom titlebar taller than
the system's, the green button then sits above the other two until the
next resize. setWindowTitle: now places the buttons again itself.
A Menu opened from a row of a list or popup covered the rows under it,
since it could only open under or over its anchor. Beside places it to the
right of the anchor, its top at the anchor's, flipping to the left when
there is no room, and slides it in from that edge. The side a Menu opens
on is now asked again in every paint, so a menu that stops calling Above
or Beside opens under its anchor again.
A List with Follow(true) chose the rows it declares from the offset the
area had in the paint before, and the layout then pinned the area to the
new end. When more rows arrived at once than the viewport holds, the
declared rows sat far above the viewport and the paint that added them
was blank; a long list that started following stayed blank until
something else repainted it.

The list now reads whether the area keeps to its end before ScrollArea
resets Follow for the paint, places its rows for the end the layout will
pin to, and asks for a bounded number of paints when a following list
still did not reach its last row (its first paint, or estimated heights
that fell short).
The fork's main never carried the six patches Lithe pins (Window.SetTitle,
Config.OnFocusLost, ui.MenuAt, MarkdownView images, centered traffic lights and
MenuItems.Beside); they lived on the list-follow-end line, which is what
v0.6.1-0.20261111102951-7850516be532 points at. Merging that line into main makes one
line carry both the patches and the new control options, so Lithe can pin a single
commit again.

ui/list.go's conflict is resolved to the snapped-offset version, which also stores the
offset on the layout node so the paint that adds rows shows the requested end; it
subsumes the change-guarded assignment from the other side, and the code below reads the
same offset.

Co-Authored-By: AtomCode (deepseek-v4.1-flash) <noreply@atomgit.com>
@1lck
1lck merged commit b6d2059 into main Nov 12, 2026
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.

2 participants