Skip to content

Commit

Permalink
Make multiline wait for cursor location before typing again
Browse files Browse the repository at this point in the history
  • Loading branch information
nhatthm committed Apr 23, 2021
1 parent f1c8b20 commit 6229fce
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions multiline.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,22 @@ func (a *MultilineAnswer) Do(c Console) error {
return nil
}

c.SendLine(a.answer)
c.SendLine("")
c.SendLine("")
lines := strings.Split(a.answer, "\n")
lines = append(lines, "")

if a.answer != "" {
lines = append(lines, "")
}

cnt := len(lines) - 1

for i, l := range lines {
c.SendLine(l)

if i < cnt {
_ = waitForCursorTwice(c)
}
}

return nil
}
Expand Down

0 comments on commit 6229fce

Please sign in to comment.