Replace textInputSupported flag

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