Skip to content

Commit f1ea31e

Browse files
authored
Merge pull request #2787 from dgageot/board/dc13d546c622d122
route mouse-wheel events to background dialogs
2 parents 369503f + c996ad0 commit f1ea31e

2 files changed

Lines changed: 7 additions & 12 deletions

File tree

pkg/tui/dialog/dialog.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ import (
1111
// OpenDialogMsg is sent to open a new dialog.
1212
//
1313
// OriginatingEvent is an optional runtime event whose presence marks the
14-
// dialog as a background dialog. Background dialogs do not block the rest of
15-
// the UI: tab navigation, tab-bar mouse clicks and chat scroll-wheel events
16-
// keep working. When the user switches away from the tab that opened the
17-
// dialog, the dialog is closed and OriginatingEvent is re-stashed in the
18-
// supervisor so the same prompt is re-displayed when the user returns.
14+
// dialog as a background dialog. Background dialogs do not block tab
15+
// navigation: tab-switch keys and tab-bar mouse clicks keep working. When
16+
// the user switches away from the tab that opened the dialog, the dialog is
17+
// closed and OriginatingEvent is re-stashed in the supervisor so the same
18+
// prompt is re-displayed when the user returns. Other input (including
19+
// mouse-wheel events) is still routed to the dialog while it is on screen.
1920
type OpenDialogMsg struct {
2021
Model Dialog
2122
OriginatingEvent tea.Msg
@@ -41,7 +42,7 @@ type Manager interface {
4142
Open() bool
4243
TopIsExitConfirmation() bool
4344
// TopIsBackground reports whether the topmost dialog is a background
44-
// dialog (i.e. it should not block tab navigation or chat scrolling).
45+
// dialog (i.e. it should not block tab navigation).
4546
TopIsBackground() bool
4647
// TopBackgroundEvent returns the originating event of the topmost
4748
// background dialog, or nil if the top dialog is not a background dialog

pkg/tui/tui.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2093,12 +2093,6 @@ func (m *appModel) handleWheelCoalesced(msg messages.WheelCoalescedMsg) (tea.Mod
20932093
}
20942094

20952095
if m.dialogMgr.Open() {
2096-
// Background dialogs (e.g. pending elicitations) let chat-area scroll
2097-
// wheel events fall through so the user can review the conversation
2098-
// behind the dialog while the prompt waits.
2099-
if m.dialogMgr.TopIsBackground() && m.hitTestRegion(msg.Y) == regionContent {
2100-
return m.forwardChat(msg)
2101-
}
21022096
return m.forwardDialog(msg)
21032097
}
21042098

0 commit comments

Comments
 (0)