fix(workspace): improve popup handling and logging
Multiple small improvements: - workspace_pane_ops.go: Don't exit app when closing popups. Popups aren't counted in app.panes, so remaining==1 check should exclude them. - handler.go: Add webviewId to workspace event logs for better debugging - workspace_hover.go: Fix formatting (gofmt spacing) These changes improve popup lifecycle handling and make debugging easier.
- commit
- eac27b20b35daf05fb7d8fc6b38ea8e2de810241
- author
- bamen · · 2025-10-13 18:03 UTC
- committer
- bamen · · 2025-10-13 21:15 UTC
- parent
- 4c6ae6a
- signature
- unsigned
3 files · +4 -3
M internal/app/browser/workspace_hover.go +1 -1
| @@ -32,7 +32,7 @@ func (wm *WorkspaceManager) ensureHover(node *paneNode) { | |||
| 32 | 32 | ||
| 33 | 33 | // Debounce hover events to prevent rapid focus changes (minimum 150ms between hover-triggered focus changes) | |
| 34 | 34 | now := glib.GetMonotonicTime() | |
| 35 | - | if node.lastHoverTime > 0 && (now - node.lastHoverTime) < 150000 { // 150ms in microseconds | |
| 35 | + | if node.lastHoverTime > 0 && (now-node.lastHoverTime) < 150000 { // 150ms in microseconds | |
| 36 | 36 | return | |
| 37 | 37 | } | |
| 38 | 38 | node.lastHoverTime = now | |
| @@ -32,7 +32,7 @@ func (wm *WorkspaceManager) ensureHover(node *paneNode) { | |||||
| 32 | 32 | ||||
| 33 | // Debounce hover events to prevent rapid focus changes (minimum 150ms between hover-triggered focus changes) | 33 | // Debounce hover events to prevent rapid focus changes (minimum 150ms between hover-triggered focus changes) | ||
| 34 | now := glib.GetMonotonicTime() | 34 | now := glib.GetMonotonicTime() | ||
| 35 | - | if node.lastHoverTime > 0 && (now - node.lastHoverTime) < 150000 { // 150ms in microseconds | 35 | + | if node.lastHoverTime > 0 && (now-node.lastHoverTime) < 150000 { // 150ms in microseconds |
| 36 | return | 36 | return | ||
| 37 | } | 37 | } | ||
| 38 | node.lastHoverTime = now | 38 | node.lastHoverTime = now | ||
M internal/app/browser/workspace_pane_ops.go +2 -1
| @@ -940,7 +940,8 @@ func (wm *WorkspaceManager) closePane(node *paneNode) (*paneNode, error) { | |||
| 940 | 940 | wm.detachFocus(node) | |
| 941 | 941 | ||
| 942 | 942 | // STEP 3: Handle trivial exit cases | |
| 943 | - | if ctx.remaining == 1 { | |
| 943 | + | // Don't exit if closing a popup - popups aren't counted in app.panes | |
| 944 | + | if ctx.remaining == 1 && !node.isPopup { | |
| 944 | 945 | return wm.cleanupAndExit(node) | |
| 945 | 946 | } | |
| 946 | 947 | if node == wm.root { | |
| @@ -940,7 +940,8 @@ func (wm *WorkspaceManager) closePane(node *paneNode) (*paneNode, error) { | |||||
| 940 | wm.detachFocus(node) | 940 | wm.detachFocus(node) | ||
| 941 | 941 | ||||
| 942 | // STEP 3: Handle trivial exit cases | 942 | // STEP 3: Handle trivial exit cases | ||
| 943 | - | if ctx.remaining == 1 { | 943 | + | // Don't exit if closing a popup - popups aren't counted in app.panes |
| 944 | + | if ctx.remaining == 1 && !node.isPopup { | |||
| 944 | return wm.cleanupAndExit(node) | 945 | return wm.cleanupAndExit(node) | ||
| 945 | } | 946 | } | ||
| 946 | if node == wm.root { | 947 | if node == wm.root { | ||
M internal/app/messaging/handler.go +1 -1
| @@ -172,7 +172,7 @@ func (h *Handler) handleWorkspace(msg Message) { | |||
| 172 | 172 | log.Printf("[workspace] Ignoring workspace event %q: webview not attached", msg.Event) | |
| 173 | 173 | return | |
| 174 | 174 | } | |
| 175 | - | log.Printf("[workspace] Forwarding workspace event: event=%s direction=%s action=%s", msg.Event, msg.Direction, msg.Action) | |
| 175 | + | log.Printf("[workspace] Forwarding workspace event: event=%s direction=%s action=%s webviewId=%s", msg.Event, msg.Direction, msg.Action, msg.WebViewID) | |
| 176 | 176 | h.workspaceObserver.OnWorkspaceMessage(h.webView, msg) | |
| 177 | 177 | } | |
| 178 | 178 | ||
| @@ -172,7 +172,7 @@ func (h *Handler) handleWorkspace(msg Message) { | |||||
| 172 | log.Printf("[workspace] Ignoring workspace event %q: webview not attached", msg.Event) | 172 | log.Printf("[workspace] Ignoring workspace event %q: webview not attached", msg.Event) | ||
| 173 | return | 173 | return | ||
| 174 | } | 174 | } | ||
| 175 | - | log.Printf("[workspace] Forwarding workspace event: event=%s direction=%s action=%s", msg.Event, msg.Direction, msg.Action) | 175 | + | log.Printf("[workspace] Forwarding workspace event: event=%s direction=%s action=%s webviewId=%s", msg.Event, msg.Direction, msg.Action, msg.WebViewID) |
| 176 | h.workspaceObserver.OnWorkspaceMessage(h.webView, msg) | 176 | h.workspaceObserver.OnWorkspaceMessage(h.webView, msg) | ||
| 177 | } | 177 | } | ||
| 178 | 178 | ||||