fix(tui): dismiss runtime pickers on outside click

This commit is contained in:
Xubin Ren
2026-08-17 20:56:10 +08:00
parent d6847b0107
commit f1ebd8c4c6
2 changed files with 31 additions and 1 deletions
+10 -1
View File
@@ -487,10 +487,15 @@ export class NanobotTui {
flexDirection: "column",
backgroundColor: RGBA.defaultBackground(),
onMouseDown: (event) => {
if (event.button !== 0) return
// Runtime pickers are transient popovers. A primary click anywhere
// outside their trigger or body dismisses them; hide() restores the
// composer focus through the shared visibility callback.
this.dismissRuntimeControls()
// Selection belongs to transcript/input content, never to empty chrome.
// Clearing it here prevents default-background cells from lingering as
// opaque blocks in terminals with differential repainting.
if (event.button === 0 && event.target && !event.target.selectable) {
if (event.target && !event.target.selectable) {
this.renderer.clearSelection()
}
},
@@ -1732,6 +1737,10 @@ export class NanobotTui {
this.activeMentionQuery = null
}
private dismissRuntimeControls(): void {
if (this.runtimeControls.visible) this.runtimeControls.hide()
}
private applyWorkspaceScope(scope: WorkspaceScopePayload): void {
if (scope.project_path) {
this.hostWorkspace = scope.project_path