Skip to content
This repository was archived by the owner on Apr 19, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions multiline.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package survey

import (
"strings"

"github.com/AlecAivazis/survey/v2/terminal"
)

type Multiline struct {
Expand Down Expand Up @@ -70,13 +68,7 @@ func (i *Multiline) Prompt(config *PromptConfig) (interface{}, error) {

if string(line) == "" {
if emptyOnce {
numLines := len(multiline) + 2
cursor.PreviousLine(numLines)
for j := 0; j < numLines; j++ {
terminal.EraseLine(i.Stdio().Out, terminal.ERASE_LINE_ALL)
cursor.NextLine(1)
}
cursor.PreviousLine(numLines)
cursor.PreviousLine(3)
break
}
emptyOnce = true
Expand Down
4 changes: 2 additions & 2 deletions terminal/cursor.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ func (c *Cursor) Back(n int) error {

// NextLine moves cursor to beginning of the line n lines down.
func (c *Cursor) NextLine(n int) error {
if err := c.Down(1); err != nil {
if err := c.Down(n); err != nil {
return err
}
return c.HorizontalAbsolute(0)
}

// PreviousLine moves cursor to beginning of the line n lines up.
func (c *Cursor) PreviousLine(n int) error {
if err := c.Up(1); err != nil {
if err := c.Up(n); err != nil {
return err
}
return c.HorizontalAbsolute(0)
Expand Down