neomacs icon indicating copy to clipboard operation
neomacs copied to clipboard

[Bug]: doom, when SPC TAB, whole window stretch

Open definepi opened this issue 1 week ago • 5 comments

Bug summary

这个复现log是在第二次按SPC TAB时,出现which-key的菜单就整个neo窗口变大了:

neomacs-debug.zip

Steps to reproduce

No response

Expected behavior

No response

Neomacs --version output

Neomacs 0.0.21
Git commit: 7b3fa9d698ba41fdbabccd9bd3e547a0afa7164a
Source date: 2026-11-22T03:37:02.000000000-05:00
Build: release-pgo for x86_64-unknown-linux-gnu with rustc 1.96.1
Standalone Rust binary for Neomacs (no C dependency)

Platform

Linux (Wayland)

Install source

Prebuilt release asset (downloaded from Releases)

Extra context

No response

definepi avatar Nov 23 '26 03:11 definepi

谢谢日志!原因找到了,不是 which-key 本身的问题:

  • 你的启动配置在 window-setup-hook 里恢复了上次的窗口大小(196×40)。
  • 因为在那之前 Doom 刚改过字体,Neomacs 把这次改大小的请求"排队"了,却没有立即发给窗口系统,所以当时窗口还是原来的大小(约 65×29)。
  • which-key 第一次弹出时会查询 frame 的像素宽度。这个查询把排队了十几秒的旧请求发了出去,窗口就突然变大了。

GNU Emacs 会在设置参数时立即应用这个大小,所以不会这样。这是 Neomacs 的 bug,已经安排修复,并会加回归测试。

临时绕过(如果你的恢复函数用的是 modify-frame-parameters / set-frame-parameter):改用 set-frame-size,它会立即生效。或者在设置之后马上调用一次 (frame-pixel-width),让大小立刻应用。


English summary. This is not caused by which-key itself.

  • The trigger: your startup code restores a 196×40 frame size from window-setup-hook.
  • The bug: Doom had just changed the font, so Neomacs queued that resize instead of sending it, and the window stayed about 65×29.
  • Why it appears with which-key: which-key's first popup queries the frame's pixel width, and that query flushed the roughly 14-second-old request, so the window jumped.
  • GNU's behaviour: GNU applies explicit width/height immediately.
  • The fix: we'll deliver explicit size changes right away, with a regression test.
  • Workaround: use set-frame-size in your restore function, which applies immediately, or call (frame-pixel-width) right after setting the size.

eval-exec avatar Nov 23 '26 03:11 eval-exec

修复已合入 main(72cba7f0ce):

  • 9b965a93e9:modify-frame-parameters / set-frame-parameter 设置的 frame 大小现在会在参数调用内部立即发给窗口系统,不再排队等到下一次像素查询(例如 which-key 第一次弹出时)。这和 GNU Emacs 的行为一致。
  • 同一批还修了 tool bar 和 frame 大小相关的几处问题:tool bar 在第一次 redisplay 时分配;被禁用或尚无按钮的 tool bar 不计入显式大小;重新启用的 tool bar 计入下一次显式大小。每处都有对照 GNU Emacs 31.1 的回归测试。

方便的话请用最新 main 构建再试一次 SPC TAB。如果窗口还会突然变大,请贴一下 M-x emacs-version 和启动日志,我们会重新打开调查。

eval-exec avatar Nov 24 '26 07:11 eval-exec

A fix for the SPC TAB window stretch is on main (cab08eb094): 9b965a93e9 (landed via 72cba7f0ce).

Could you confirm against a current build? If the stretch still happens, the smallest recipe you can give — which key, which buffer, and what the window looks like before/after — would let us reproduce it without a full doom install.

eval-exec avatar Nov 25 '26 21:11 eval-exec

Closing as fixed on main (8471a2c0d1).

Root cause from the attached neomacs-debug.log (0.0.21 7b3fa9d698): after Doom changed the frame font, the resize-defer flag stayed set, so window-setup-hook's explicit modify-frame-parameters / set-frame-parameter resize (196x40) was queued instead of delivered to the window system and only flushed ~14 s later when which-key's first popup queried (frame-pixel-width).

Landed fix on main:

  • 9b965a93e9 (landed via 72cba7f0ce) — delivers explicit width/height frame-parameter changes immediately inside the parameter call and clears the defer flag on no-resize font changes, matching GNU Emacs 31.1 (src/frame.c:5207-5220, :5307, :886-900, :976-995).

Verified on 8471a2c0d1: all 33 frame_resize_host_test regression tests pass (alongside the GNU 31.1 frame_resize_oracle fixture explicit-size-after-font-oracle.el).

If SPC TAB still stretches the window on a build from 8471a2c0d1 or later (or the next release), please reopen with M-x emacs-version and a fresh debug log.

eval-exec avatar Nov 26 '26 05:11 eval-exec

我自己在Commit 9ca34ff 上编译测试了一下,确实解决了。

definepi avatar Nov 26 '26 11:11 definepi