Files
cthulhu/internal/app/speech_title_input.go

24 lines
819 B
Go

// Copyright (c) 2026 Storm Dragon
// Authors: Storm Dragon, Angus Kola
// SPDX-License-Identifier: GPL-3.0-or-later
package app
import "git.stormux.org/storm/cthulhu/internal/input"
// titleInputPolicy follows the latest accepted presentation, including the
// period after SPEAK returns while the synthesizer is still speaking it.
// Only automatic titles ignore repeats. Normal reading keeps its input policy.
// The speech worker's mutex owns this state.
type titleInputPolicy struct {
protectRepeats bool
}
func (policy *titleInputPolicy) observe(request speechRequest) {
policy.protectRepeats = request.Cause == "window-title" && request.Text != ""
}
func (policy *titleInputPolicy) preserves(event input.Event) bool {
return policy.protectRepeats && event.Pressed && !input.ShouldInterruptTitle(event)
}