Skip to content

Commit c0575d1

Browse files
committed
confirm: properly clear the terminal in case of a multi-line prompt string.
1 parent c4fdc9c commit c0575d1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/prompts/confirm.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ impl Confirm<'_> {
210210
continue;
211211
}
212212
};
213-
214-
term.clear_line()?;
213+
// Since `prompt` may be a multi-line string, we clear the entire prompt and not just the current line.
214+
render.clear()?;
215215
render.confirm_prompt(&self.prompt, value)?;
216216
}
217217
} else {
@@ -234,7 +234,8 @@ impl Confirm<'_> {
234234
}
235235
}
236236

237-
term.clear_line()?;
237+
// Since `prompt` may be a multi-line string, we clear the entire prompt and not just the current line.
238+
render.clear()?;
238239
if self.report {
239240
render.confirm_prompt_selection(&self.prompt, rv)?;
240241
}

0 commit comments

Comments
 (0)