fix(expand): clear line before printing option

This commit is contained in:
Anna 2023-09-10 16:36:21 -04:00
parent c454826c25
commit e551d19f95
Signed by: anna
GPG Key ID: D0943384CD9F87D1
1 changed files with 3 additions and 0 deletions

View File

@ -11,6 +11,7 @@ use ui::{
use super::{Choice, Transform};
use crate::{Answer, Answers, ExpandItem};
pub use builder::ExpandBuilder;
use ui::backend::ClearType;
mod builder;
@ -29,6 +30,7 @@ impl Widget for ExpandText {
layout: &mut ui::layout::Layout,
backend: &mut B,
) -> io::Result<()> {
backend.clear(ClearType::CurrentLine)?;
self.text.render(layout, backend)
}
@ -158,6 +160,7 @@ impl<F: Fn(char) -> Option<char>> ui::Widget for ExpandPrompt<'_, F> {
}
None => {
layout.offset_y += 1;
b.clear(ClearType::CurrentLine)?;
b.write_all(b"Help, list all options")?;
b.move_cursor(MoveDirection::NextLine(1))?;
}