Fixed bug where selection wasn't overwritten by typed character.
This commit is contained in:
parent
ae46d2a1f2
commit
add33c6e7e
@ -232,6 +232,9 @@ func (b *TextBox) Handle(ctx Context, e Event) bool {
|
|||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
case *TextInputEvent:
|
case *TextInputEvent:
|
||||||
|
if b.Selection.HasSelection() {
|
||||||
|
b.cut()
|
||||||
|
}
|
||||||
caret := b.Selection.Caret
|
caret := b.Selection.Caret
|
||||||
b.Text = fmt.Sprintf("%s%c%s", b.Text[:caret], e.Character, b.Text[caret:])
|
b.Text = fmt.Sprintf("%s%c%s", b.Text[:caret], e.Character, b.Text[caret:])
|
||||||
b.Selection.Caret = caret + 1
|
b.Selection.Caret = caret + 1
|
||||||
|
Loading…
Reference in New Issue
Block a user