exp/textinput: bug fix: DEL char should not be inserted

Closes #3212
This commit is contained in:
Hajime Hoshi
2025-04-21 02:46:38 +09:00
parent 1b06587435
commit 0a20b41203
+5
View File
@@ -124,6 +124,11 @@ func (f *Field) HandleInput(x, y int) (handled bool, err error) {
f.state = State{}
break readchar
}
if state.Committed && state.Text == "\x7f" {
// DEL should not modify the text (#3212).
f.state = State{}
continue
}
handled = true
if state.Committed {
f.text = f.text[:f.selectionStartInBytes] + state.Text + f.text[f.selectionEndInBytes:]