Replace textInputSupported flag

This commit is contained in:
NeilClack
2026-06-27 00:37:07 -05:00
parent 16ae451686
commit 2fac3ab6a8
+3 -1
View File
@@ -38,6 +38,7 @@ const (
type WiFiSetupPage struct {
Base
applicationFont *fontManager.FontEntry
textInputSupported bool
// UI elements
BaseFontSize int
@@ -134,6 +135,7 @@ func (p *WiFiSetupPage) HandleEvent(event *sdl.Event) error {
// SDL fires TextInputEvent for every printable character typed.
// This is the correct SDL2 way — no manual keycode mapping needed.
if p.isEnteringPassword {
p.textInputSupported = true
p.passwordInput += e.GetText()
p.rebuildPasswordTexture()
}
@@ -158,7 +160,6 @@ func (p *WiFiSetupPage) handlePasswordKey(sym sdl.Keycode) {
case sdl.K_BACKSPACE:
if len(p.passwordInput) > 0 {
// Trim one rune safely
runes := []rune(p.passwordInput)
p.passwordInput = string(runes[:len(runes)-1])
p.rebuildPasswordTexture()
@@ -213,6 +214,7 @@ func (p *WiFiSetupPage) handleNavKey(sym sdl.Keycode) {
func (p *WiFiSetupPage) enterPasswordMode() {
keybinds.Enabled = false
p.isEnteringPassword = true
p.textInputSupported = false
p.rebuildPasswordPromptTexture()
p.rebuildPasswordTexture()
sdl.StartTextInput()