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")
cmd := exec.Command("notify-send", strings.TrimRight(buf.String(), "\n"))
cmd.Run()
go func(buf *strings.Builder) {
input <- buf.String()
}(buf)
v.Clear()
v.SetCursor(0, 0)
// go func(buf *strings.Builder) {
// input <- buf.String()
// }(buf)
return nil
}); err != nil {
return err