Change OnEnter to OnConfirm

Full remediation of #6
This commit is contained in:
2024-06-27 14:09:58 -04:00
parent 638fc61d83
commit 1125d98b3d
5 changed files with 32 additions and 32 deletions

View File

@@ -11,8 +11,8 @@ type TextInput struct {
tomo.TextBox
text []rune
on struct {
enter event.FuncBroadcaster
valueChange event.FuncBroadcaster
confirm event.FuncBroadcaster
}
}
@@ -41,10 +41,10 @@ func (this *TextInput) Text () string {
return string(this.text)
}
// OnEnter specifies a function to be called when the user presses enter within
// the text input.
func (this *TextInput) OnEnter (callback func ()) event.Cookie {
return this.on.enter.Connect(callback)
// OnConfirm specifies a function to be called when the user presses enter
// within the text input.
func (this *TextInput) OnConfirm (callback func ()) event.Cookie {
return this.on.confirm.Connect(callback)
}
// OnValueChange specifies a function to be called when the user edits the input
@@ -65,7 +65,7 @@ func (this *TextInput) handleKeyDown (key input.Key, numpad bool) {
switch {
case key == input.KeyEnter:
this.on.enter.Broadcast()
this.on.confirm.Broadcast()
case key == input.KeyHome || (modifiers.Alt && key == input.KeyLeft):
dot.End = 0
if !sel { dot.Start = dot.End }