Skip to content

Commit fb57705

Browse files
hajimehoshiclaude
andcommitted
example/gallery: add comment explaining why SetTextFieldValue is needed
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent eeb4762 commit fb57705

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

example/gallery/ui.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,9 @@ func (g *Game) logWindow(ctx *debugui.Context) {
207207
ctx.TextField(&g.logSubmitBuf).On(func() {
208208
if ebiten.IsKeyPressed(ebiten.KeyEnter) {
209209
submit()
210+
// SetTextFieldValue is needed because while the text field has focus,
211+
// its internal state is the source of truth and overwrites the buffer each frame.
212+
// Simply clearing the buffer via submit() would be undone on the next frame.
210213
ctx.SetTextFieldValue("")
211214
}
212215
})

0 commit comments

Comments
 (0)