mirror of
https://github.com/uutils/coreutils
synced 2024-12-13 23:02:38 +00:00
fix behavior of -c and -p commands
This commit is contained in:
parent
1a12ffaa79
commit
2d1a9f6709
2 changed files with 12 additions and 7 deletions
|
@ -333,9 +333,14 @@ fn more(
|
|||
_ => continue,
|
||||
}
|
||||
|
||||
if options.clean_print {
|
||||
execute!(std::io::stdout(), Clear(ClearType::Purge), MoveTo(0, 0)).unwrap();
|
||||
} else if options.print_over {
|
||||
if options.print_over {
|
||||
execute!(
|
||||
std::io::stdout(),
|
||||
MoveTo(0, 0),
|
||||
Clear(ClearType::FromCursorDown)
|
||||
)
|
||||
.unwrap();
|
||||
} else if options.clean_print {
|
||||
execute!(std::io::stdout(), Clear(ClearType::All), MoveTo(0, 0)).unwrap();
|
||||
}
|
||||
pager.draw(stdout, wrong_key);
|
||||
|
|
|
@ -13,11 +13,11 @@ fn test_more_no_arg() {
|
|||
#[test]
|
||||
fn test_valid_arg() {
|
||||
if std::io::stdout().is_terminal() {
|
||||
new_ucmd!().arg("-c").succeeds().code_is(0);
|
||||
new_ucmd!().arg("--print-over").succeeds().code_is(0);
|
||||
new_ucmd!().arg("-c").succeeds();
|
||||
new_ucmd!().arg("--print-over").succeeds();
|
||||
|
||||
new_ucmd!().arg("-p").succeeds().code_is(0);
|
||||
new_ucmd!().arg("--clean-print").succeeds().code_is(0);
|
||||
new_ucmd!().arg("-p").succeeds();
|
||||
new_ucmd!().arg("--clean-print").succeeds();
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue