From d93be2b37b6be23ade83dc4520fdcdc91c7d1085 Mon Sep 17 00:00:00 2001 From: raul Date: Wed, 10 Apr 2024 09:01:55 +0200 Subject: [PATCH] Editor properly empties text after hitting enter Realized I could use v.SetCursor and v.Clear to easily control the view --- gocui-practice/main.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gocui-practice/main.go b/gocui-practice/main.go index b9a4982..4e8e848 100644 --- a/gocui-practice/main.go +++ b/gocui-practice/main.go @@ -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