mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-11 05:31:14 -03:00
Add ScreenData::clear_lines() instead of ScreenDate::resize(0)
Part of #11911
This commit is contained in:
committed by
Johannes Altmanninger
parent
bb7180a2d8
commit
9d06302778
@@ -909,7 +909,7 @@ pub fn render(&self) -> PageRendering {
|
||||
rendering.search_field_line = self.search_field_line.clone();
|
||||
for cols in (1..=PAGER_MAX_COLS).rev() {
|
||||
// Initially empty rendering.
|
||||
rendering.screen_data.resize(0);
|
||||
rendering.screen_data.clear_lines();
|
||||
|
||||
// Determine how many rows we would need if we had 'cols' columns. Then determine how many
|
||||
// columns we want from that. For example, say we had 19 completions. We can fit them into 6
|
||||
|
||||
@@ -163,6 +163,10 @@ pub fn add_line(&mut self) -> &mut Line {
|
||||
self.line_datas.last_mut().unwrap()
|
||||
}
|
||||
|
||||
pub fn clear_lines(&mut self) {
|
||||
self.line_datas.clear()
|
||||
}
|
||||
|
||||
pub fn resize(&mut self, size: usize) {
|
||||
self.line_datas.resize(size, Default::default())
|
||||
}
|
||||
@@ -350,7 +354,7 @@ struct ScrolledCursor {
|
||||
|
||||
// Clear the desired screen and set its width.
|
||||
self.desired.screen_width = Some(screen_width);
|
||||
self.desired.resize(0);
|
||||
self.desired.clear_lines();
|
||||
self.desired.cursor.x = 0;
|
||||
self.desired.cursor.y = 0;
|
||||
|
||||
@@ -554,7 +558,7 @@ pub fn reset_line(&mut self, repaint_prompt: bool /* = false */) {
|
||||
self.actual_left_prompt = None;
|
||||
self.need_clear_screen = true;
|
||||
}
|
||||
self.actual.resize(0);
|
||||
self.actual.clear_lines();
|
||||
self.need_clear_lines = true;
|
||||
|
||||
// This should prevent resetting the cursor position during the next repaint.
|
||||
@@ -674,7 +678,7 @@ pub fn offset_in_cmdline_given_cursor(
|
||||
/// The screen width must be provided for the PROMPT_SP hack.
|
||||
pub fn reset_abandoning_line(&mut self, screen_width: usize) {
|
||||
self.actual.cursor.y = 0;
|
||||
self.actual.resize(0);
|
||||
self.actual.clear_lines();
|
||||
self.actual_left_prompt = None;
|
||||
self.need_clear_lines = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user