Skip to content

Commit 35f113e

Browse files
committed
Minimal fix for better input support on windows
Signed-off-by: Christopher Petito <[email protected]>
1 parent a8c071e commit 35f113e

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

cmd/root/run.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,7 @@ func runCommand(_ *cobra.Command, args []string, exec bool) error {
199199
}
200200

201201
// For `cagent run --tui=false`
202-
//
203-
// NOTE(krissetto): TUI is temporarily disabled on windows because of input issues.
204-
// see github.com/docker/cagent/issues/80 for more details.
205-
if !useTUI || goRuntime.GOOS == "windows" {
202+
if !useTUI {
206203
return runWithoutTUI(ctx, agentFilename, rt, sess, args)
207204
}
208205

@@ -225,14 +222,19 @@ func runCommand(_ *cobra.Command, args []string, exec bool) error {
225222
a := app.New(agentFilename, rt, sess, firstMessage)
226223
m := tui.New(a)
227224

228-
p := tea.NewProgram(
229-
m,
225+
progOpts := []tea.ProgramOption{
230226
tea.WithAltScreen(),
231227
tea.WithContext(ctx),
228+
tea.WithFilter(tui.MouseEventFilter),
232229
tea.WithMouseCellMotion(),
233230
tea.WithMouseAllMotion(),
234-
tea.WithFilter(tui.MouseEventFilter),
235-
)
231+
}
232+
if goRuntime.GOOS == "windows" {
233+
// WithInputTTY seems to be required for proper keyboard input
234+
progOpts = append(progOpts, tea.WithInputTTY())
235+
}
236+
237+
p := tea.NewProgram(m, progOpts...)
236238

237239
go a.Subscribe(ctx, p)
238240

0 commit comments

Comments
 (0)