Fixed bug where selection wasn't overwritten by typed character.

This commit is contained in:
Sander Schobers 2020-05-16 13:47:25 +02:00
parent ae46d2a1f2
commit add33c6e7e

View File

@ -232,6 +232,9 @@ func (b *TextBox) Handle(ctx Context, e Event) bool {
}
return true
case *TextInputEvent:
if b.Selection.HasSelection() {
b.cut()
}
caret := b.Selection.Caret
b.Text = fmt.Sprintf("%s%c%s", b.Text[:caret], e.Character, b.Text[caret:])
b.Selection.Caret = caret + 1