1
1
Fork 0

Adds comments and a call to show cursor

This commit is contained in:
sloum 2021-04-03 23:03:16 -07:00
parent 48bedb4e12
commit f040d8db6a
1 changed files with 3 additions and 2 deletions

View File

@ -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