Fixes an issue with seed content
This commit is contained in:
parent
0e5b1ba06b
commit
48bedb4e12
13
qline.go
13
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()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue