mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
Merge pull request #2354 from tertsdiepraam/more/fix-not-showing-last-line
`more`: Do not accidentically hide last line
This commit is contained in:
commit
9ae3c7634c
1 changed files with 2 additions and 2 deletions
|
@ -349,7 +349,7 @@ fn calc_range(mut upper_mark: u16, rows: u16, line_count: u16) -> (u16, u16) {
|
||||||
let mut lower_mark = upper_mark.saturating_add(rows);
|
let mut lower_mark = upper_mark.saturating_add(rows);
|
||||||
|
|
||||||
if lower_mark >= line_count {
|
if lower_mark >= line_count {
|
||||||
upper_mark = line_count.saturating_sub(rows);
|
upper_mark = line_count.saturating_sub(rows).saturating_add(1);
|
||||||
lower_mark = line_count;
|
lower_mark = line_count;
|
||||||
} else {
|
} else {
|
||||||
lower_mark = lower_mark.saturating_sub(1)
|
lower_mark = lower_mark.saturating_sub(1)
|
||||||
|
@ -380,7 +380,7 @@ mod tests {
|
||||||
fn test_calc_range() {
|
fn test_calc_range() {
|
||||||
assert_eq!((0, 24), calc_range(0, 25, 100));
|
assert_eq!((0, 24), calc_range(0, 25, 100));
|
||||||
assert_eq!((50, 74), calc_range(50, 25, 100));
|
assert_eq!((50, 74), calc_range(50, 25, 100));
|
||||||
assert_eq!((75, 100), calc_range(85, 25, 100));
|
assert_eq!((76, 100), calc_range(85, 25, 100));
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_break_lines_long() {
|
fn test_break_lines_long() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue