Skip to content

Commit 6229fce

Browse files
committed
Make multiline wait for cursor location before typing again
1 parent f1c8b20 commit 6229fce

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

multiline.go

+16-3
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,22 @@ func (a *MultilineAnswer) Do(c Console) error {
127127
return nil
128128
}
129129

130-
c.SendLine(a.answer)
131-
c.SendLine("")
132-
c.SendLine("")
130+
lines := strings.Split(a.answer, "\n")
131+
lines = append(lines, "")
132+
133+
if a.answer != "" {
134+
lines = append(lines, "")
135+
}
136+
137+
cnt := len(lines) - 1
138+
139+
for i, l := range lines {
140+
c.SendLine(l)
141+
142+
if i < cnt {
143+
_ = waitForCursorTwice(c)
144+
}
145+
}
133146

134147
return nil
135148
}

0 commit comments

Comments
 (0)