From f040d8db6a9e5156699eed870e09f154147eadd2 Mon Sep 17 00:00:00 2001 From: sloum Date: Sat, 3 Apr 2021 23:03:16 -0700 Subject: [PATCH] Adds comments and a call to show cursor --- qline.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qline.go b/qline.go index 18dcc8f..99ffdeb 100644 --- a/qline.go +++ b/qline.go @@ -70,10 +70,11 @@ type buffer struct { func GetInput(prompt string, content string) string { termios.SetCharMode() cols, _ := termios.GetWindowSize() - b := buffer{make([]rune, 0, (len(content)+1)*2), 0, cols-len(prompt), 0, 0, prompt} + b := buffer{make([]rune, 0, (len(content)+1)*2), 0, cols-len(prompt), 0, len(prompt), prompt} + fmt.Print("\033[25h") // Make sure cursor is visible fmt.Print(prompt) - fmt.Print("\033[6n") + fmt.Print("\033[6n") // Query for cursor position var ch rune var err error