Repository navigation
Conversation
The active tab was focused while its host window was still hidden. On Windows this races window activation (WM_ACTIVATE) against Chromium assigning the text-input focus. When the race is lost, the TSF composition window is never moved from the screen origin, so typing Korean right after launch draws the composition string at the top-left corner in addition to the caret. Clicking outside the window and back re-created the input context, which is why it looked like a focus bug. Focus the active tab on the window's first native focus event instead, and give the hidden xterm textarea an in-bounds anchor so Windows has a usable caret rect before xterm positions the textarea on cursor movement. Evidence: enumerating Win32 windows during the first real composition showed a CiceroUIWndFrame owned by the Wave UI thread at rect (0,0,53,31), while the xterm preedit overlay was measured at the caret (138,114). A build with only the textarea anchor still reproduced the window; adding the focus ordering made it disappear.
|
No actionable comments were generated in the recent review. WalkthroughTab focus now waits for the next window focus event when a Windows window is hidden. The focus callback checks window and tab state and retries focus under specified conditions. On Windows, the terminal textarea receives the Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk:
|
Problem
On Windows, typing Korean immediately after launching Wave (before clicking anywhere) draws the composition string twice: once at the caret, and once at the top-left corner of the window. Clicking outside the window and back makes it go away.
The caret copy is xterm's
.composition-view— measured over CDP it sits exactly on the caret (138,114), so it is not the culprit.Enumerating Win32 windows during the first real composition showed what is:
CiceroUIWndFrameis the TSF composition window, owned by Wave's own UI thread, parked at the screen origin.Cause
setTabViewIntoWindow()focuses the tab'swebContentsright after initialization — while the host window is still hidden (show: false, it is shown later byrelaunchBrowserWindows()). On Windows that races window activation (WM_ACTIVATE) against Chromium assigning the initial text-input focus. When the race is lost the TSF document manager / caret is never bound to the real widget, so Windows keeps drawing the composition window at(0, 0). Deactivating and re-activating the window re-creates the input context, which is why the manual workaround worked.webContents.focus()called aftershow()does not fix it — the wrong ordering already happened; the focus has to be deferred, not repeated.Fix
emain/emain-window.ts: on Windows, if the window is not visible yet, wait for its first nativefocusevent before focusing the active tab. Visible windows (tab switches) and other platforms focus immediately, as before. The existing 10/30 ms refocus retries are kept, now shared by both paths.frontend/app/view/term/termwrap.ts+xterm.css: tag xterm's hidden textarea withwave-windows-ime-anchoron Windows so it has an in-bounds1x1box before xterm positions it on the first cursor movement. Without it the textarea is0x0off-screen, which gives IME nothing to anchor to.Testing
(0, 0)every launch.CiceroUIWndFrameat the origin on repeated launches, and the reporter confirmed normal Korean input on the shipped build.Notes
Windows-only; macOS/Linux take the old immediate-focus path.