From 48bedb4e122c31a3b7317eda13bc27c2d74632a8 Mon Sep 17 00:00:00 2001 From: sloum Date: Sat, 3 Apr 2021 22:56:58 -0700 Subject: [PATCH] Fixes an issue with seed content --- qline.go | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/qline.go b/qline.go index 4cfdb16..18dcc8f 100644 --- a/qline.go +++ b/qline.go @@ -71,7 +71,6 @@ 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} - seeded := false fmt.Print(prompt) fmt.Print("\033[6n") @@ -85,6 +84,8 @@ func GetInput(prompt string, content string) string { if err != nil && err.Error() == "response" { b.cursorStart = int(ch) b.maxWidth = cols - b.cursorStart + b.seedContent(content) + b.printBuf() } else if err != nil { continue } @@ -97,16 +98,6 @@ func GetInput(prompt string, content string) string { } else { b.addChar(ch, true) } - - // Seeding the content needs to happen - // _after_ reading in the width from the [6n - // function call. - if !seeded { - b.seedContent(content) - b.printBuf() - seeded = true - } - } return b.string() }