From add33c6e7e8e2582678681682744a3a226d28afa Mon Sep 17 00:00:00 2001 From: Sander Schobers Date: Sat, 16 May 2020 13:47:25 +0200 Subject: [PATCH] Fixed bug where selection wasn't overwritten by typed character. --- ui/textbox.go | 3 +++ 1 file changed, 3 insertions(+) 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