diff --git a/ui/textbox.go b/ui/textbox.go index 61abd0a..4942a54 100644 --- a/ui/textbox.go +++ b/ui/textbox.go @@ -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