mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
pr: fix printing form feed
This commit is contained in:
parent
847046f3de
commit
87227addc1
1 changed files with 7 additions and 4 deletions
11
src/pr/pr.rs
11
src/pr/pr.rs
|
@ -62,6 +62,7 @@ static READ_BUFFER_SIZE: usize = 1024 * 64;
|
||||||
static DEFAULT_COLUMN_WIDTH: usize = 72;
|
static DEFAULT_COLUMN_WIDTH: usize = 72;
|
||||||
static DEFAULT_COLUMN_SEPARATOR: &char = &TAB;
|
static DEFAULT_COLUMN_SEPARATOR: &char = &TAB;
|
||||||
static BLANK_STRING: &str = "";
|
static BLANK_STRING: &str = "";
|
||||||
|
static FF: u8 = 0x0C as u8;
|
||||||
|
|
||||||
struct OutputOptions {
|
struct OutputOptions {
|
||||||
/// Line numbering mode
|
/// Line numbering mode
|
||||||
|
@ -630,10 +631,12 @@ fn build_options(
|
||||||
page_length - (HEADER_LINES_PER_PAGE + TRAILER_LINES_PER_PAGE)
|
page_length - (HEADER_LINES_PER_PAGE + TRAILER_LINES_PER_PAGE)
|
||||||
};
|
};
|
||||||
|
|
||||||
let page_separator_char: String = matches
|
let page_separator_char: String = if matches.opt_present(FORM_FEED_OPTION) {
|
||||||
.opt_str(FORM_FEED_OPTION)
|
let bytes = vec![FF];
|
||||||
.map(|_i| '\u{000A}'.to_string())
|
String::from_utf8(bytes).unwrap()
|
||||||
.unwrap_or(NEW_LINE.to_string());
|
} else {
|
||||||
|
NEW_LINE.to_string()
|
||||||
|
};
|
||||||
|
|
||||||
let column_width: usize =
|
let column_width: usize =
|
||||||
parse_usize(matches, COLUMN_WIDTH_OPTION).unwrap_or(Ok(DEFAULT_COLUMN_WIDTH))?;
|
parse_usize(matches, COLUMN_WIDTH_OPTION).unwrap_or(Ok(DEFAULT_COLUMN_WIDTH))?;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue