Skip to content

Commit 560ecf6

Browse files
committed
fix term clear when paging to a max_length less than self.items
1 parent 028aaf6 commit 560ecf6

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/prompts/multi_select.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,8 @@ impl MultiSelect<'_> {
266266
if allow_quit {
267267
if self.clear {
268268
render.clear()?;
269+
} else {
270+
term.clear_last_lines(paging.capacity)?;
269271
}
270272

271273
term.show_cursor()?;

src/prompts/select.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,9 @@ impl Select<'_> {
278278
Key::Escape | Key::Char('q') => {
279279
if allow_quit {
280280
if self.clear {
281-
term.clear_last_lines(self.items.len())?;
281+
render.clear()?;
282+
} else {
283+
term.clear_last_lines(paging.capacity)?;
282284
}
283285

284286
term.show_cursor()?;

src/prompts/sort.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,9 @@ impl Sort<'_> {
277277
Key::Escape | Key::Char('q') => {
278278
if allow_quit {
279279
if self.clear {
280-
term.clear_last_lines(self.items.len())?;
280+
render.clear()?;
281+
} else {
282+
term.clear_last_lines(paging.capacity)?;
281283
}
282284

283285
term.show_cursor()?;

0 commit comments

Comments
 (0)