fix(candwnd): measure wrapped horizontal candidates correctly

Allow candidate items to wrap at the width limit so the native window height accounts for additional rows.
This commit is contained in:
fanlusky committed 2026-07-29 23:13:23 +08:00
1 parent 08a9825e08
commit 2bacc57b91
1 file changed
+5 -4
+5 -4
View File
@@ -72,12 +72,13 @@ void GetContainerSizeCand(ComPtr<ICoreWebView2> webview, std::function<void(std:
box.style.maxWidth = maxW + "px";
box.style.width = "fit-content";
box.style.boxSizing = "border-box";
// Match horizontal CSS: keep candidates on one row; wrap only
// inside each candidate when its own text exceeds maxW.
box.style.whiteSpace = "nowrap";
// Let complete candidate items wrap once their combined width
// reaches maxW. An individual overlong item can still wrap
// internally because its wrapper is capped to the container.
box.style.whiteSpace = "normal";
box.querySelectorAll(".row-wrapper").forEach(function (node) {{
node.style.minWidth = "0";
node.style.maxWidth = maxW + "px";
node.style.maxWidth = "100%";
node.style.whiteSpace = "normal";
node.style.overflowWrap = "anywhere";
node.style.wordBreak = "break-word";