mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 15:45:38 +00:00
widget: no newline in editor on submit
When you press enter to "submit" an editor widget, don't also append the newline to the editor text. Enter should be "submit" or "add newline" but not both. Also add parens to the Enter check: x && y || z => x && (y || z). Signed-off-by: Larry Clapp <larry@theclapp.org>
This commit is contained in:
+2
-1
@@ -153,11 +153,12 @@ func (e *Editor) processKey(gtx *layout.Context) {
|
||||
if !e.focused {
|
||||
break
|
||||
}
|
||||
if e.Submit && ke.Name == key.NameReturn || ke.Name == key.NameEnter {
|
||||
if e.Submit && (ke.Name == key.NameReturn || ke.Name == key.NameEnter) {
|
||||
if !ke.Modifiers.Contain(key.ModShift) {
|
||||
e.events = append(e.events, SubmitEvent{
|
||||
Text: e.Text(),
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
if e.command(ke) {
|
||||
|
||||
Reference in New Issue
Block a user