Editor properly empties text after hitting enter

Realized I could use v.SetCursor and v.Clear to easily control the view
This commit is contained in:
raul 2024-04-10 09:01:55 +02:00
parent 06b23f99c8
commit d93be2b37b
1 changed files with 5 additions and 3 deletions

View File

@ -142,9 +142,11 @@ func initKeybindings(g *gocui.Gui) error {
strings.TrimRight(buf.String(), "\n") strings.TrimRight(buf.String(), "\n")
cmd := exec.Command("notify-send", strings.TrimRight(buf.String(), "\n")) cmd := exec.Command("notify-send", strings.TrimRight(buf.String(), "\n"))
cmd.Run() cmd.Run()
go func(buf *strings.Builder) { v.Clear()
input <- buf.String() v.SetCursor(0, 0)
}(buf) // go func(buf *strings.Builder) {
// input <- buf.String()
// }(buf)
return nil return nil
}); err != nil { }); err != nil {
return err return err