Skip to content

Commit

Permalink
fix(screen): Breaking external API for num_lines function
Browse files Browse the repository at this point in the history
  • Loading branch information
AMythicDev committed Mar 6, 2024
1 parent 36da3ca commit 7e54a79
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/core/utils/display/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ pub fn draw_for_change(
ps.screen.line_wrapping,
ps.left_mark,
ps.line_numbers.is_on(),
ps.screen.get_line_count(),
ps.screen.line_count(),
)?;

ps.upper_mark = *new_upper_mark;
Expand Down Expand Up @@ -301,7 +301,7 @@ pub fn write_from_pagerstate(out: &mut impl Write, ps: &mut PagerState) -> Resul
ps.screen.line_wrapping,
ps.left_mark,
ps.line_numbers.is_on(),
ps.screen.get_line_count(),
ps.screen.line_count(),
)
}

Expand Down
4 changes: 2 additions & 2 deletions src/screen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl Screen {
}
/// Get the number of [`Lines`](std::str::Lines) in the text.
#[must_use]
pub const fn get_line_count(&self) -> usize {
pub const fn line_count(&self) -> usize {
self.line_count
}
/// Returns all the [Rows] within the bounds
Expand Down Expand Up @@ -92,7 +92,7 @@ impl Screen {
// text for the FormatOpts.
let clean_append = self.orig_text.ends_with('\n') || self.orig_text.is_empty();
// We check if number of digits in current line count change during this text push.
let old_lc = self.get_line_count();
let old_lc = self.line_count();

// Conditionally appends to [`self.formatted_lines`] or changes the last unterminated rows of
// [`self.formatted_lines`]
Expand Down
4 changes: 2 additions & 2 deletions src/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ where
iso.screen.line_wrapping,
iso.initial_left_mark,
iso.line_numbers,
iso.screen.get_line_count(),
iso.screen.line_count(),
)?;
Ok(())
};
Expand Down Expand Up @@ -341,7 +341,7 @@ where
iso.screen.line_wrapping,
iso.initial_left_mark,
iso.line_numbers,
iso.screen.get_line_count(),
iso.screen.line_count(),
)?;
} else {
reset_screen(out, so)?;
Expand Down
8 changes: 4 additions & 4 deletions src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl Default for SearchState {
.as_ref()
.unwrap()
.screen
.get_line_count()
.line_count()
<= 5000
});
Self {
Expand Down Expand Up @@ -365,7 +365,7 @@ impl PagerState {
}

pub(crate) fn append_str(&mut self, text: &str) -> AppendStyle {
let old_lc = self.screen.get_line_count();
let old_lc = self.screen.line_count();
let old_lc_dgts = minus_core::utils::digits(old_lc);
let mut append_result = self.screen.push_screen_buf(
text,
Expand All @@ -374,7 +374,7 @@ impl PagerState {
#[cfg(feature = "search")]
&self.search_state.search_term,
);
let new_lc = self.screen.get_line_count();
let new_lc = self.screen.line_count();
let new_lc_dgts = minus_core::utils::digits(new_lc);
#[cfg(feature = "search")]
{
Expand All @@ -395,7 +395,7 @@ impl PagerState {
return AppendStyle::FullRedraw;
}

let total_rows = self.screen.get_line_count();
let total_rows = self.screen.line_count();
let fmt_lines = &self.screen.get_formatted_lines_with_bounds(
total_rows - append_result.rows_formatted,
total_rows - 1,
Expand Down

0 comments on commit 7e54a79

Please sign in to comment.