Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions toolkit/tools/imagegen/attendedinstaller/attendedinstaller.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ import (
const (
defaultGridWeight = 1

enterCooldown = 50 * time.Millisecond

textRow = 3
textColumn = 0
textRowSpan = 1
Expand Down Expand Up @@ -68,6 +70,7 @@ type AttendedInstaller struct {
grid *tview.Grid
pauseCustomInput bool
pauseSpeakupInput bool
ignoreEnterUntil time.Time
currentView int
allViews []views.View
backdropStyle tview.Theme
Expand Down Expand Up @@ -199,6 +202,9 @@ func (ai *AttendedInstaller) showView(newView int) (err error) {
return
}

// Apply Enter cooldown to all views to prevent carried key events from auto-advancing.
ai.ignoreEnterUntil = time.Now().Add(enterCooldown)

ai.grid.AddItem(view.Primitive(), primaryContentRow, primaryContentColumn, primaryContentRowSpan, primaryContentColumnSpan, primaryContentMinSize, primaryContentMinSize, true)
ai.app.SetFocus(ai.grid)
ai.currentView = newView
Expand All @@ -221,6 +227,10 @@ func (ai *AttendedInstaller) quit() {
}

func (ai *AttendedInstaller) globalInputCapture(event *tcell.EventKey) *tcell.EventKey {
if event.Key() == tcell.KeyEnter && !ai.ignoreEnterUntil.IsZero() && time.Now().Before(ai.ignoreEnterUntil) {
return nil
}

// If we're clearing the speakup buffer, don't process keypresses
// tcell has no easy way of differentiating between keypad enter (speakup clear) and enter
if ai.pauseSpeakupInput && event.Key() == tcell.KeyEnter {
Expand Down
Loading