Skip to content

Commit

Permalink
added feature 'show-nonprinting'
Browse files Browse the repository at this point in the history
  • Loading branch information
Skosulor committed Jun 6, 2020
1 parent 4daf351 commit 9d2cd99
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ if no file is given, input is taken from `stdin`
* [X] print file
* [X] Read from stdin and print
* [X] Handle input error
* [ ] Options
* [ ] -A, --show-all
* [X] Options
* [X] -A, --show-all equivalent to -vET
* [X] -b, --number-nonblank
* [ ] -e, equivalent to -vE
* [X] -e, equivalent to -vE
* [X] -E, --show-ends
* [X] -n, --number
* [X] -s, --squeeze blank
* [ ] -t equivalent to -vT
* [X] -t equivalent to -vT
* [X] -T, --show-tabs
* [X] -u (ignored)
* [ ] -v, --show-nonprinting
* [ ] --help display this help and exit
* [ ] --version
* [X] -v, --show-nonprinting
* [X] --help display this help and exit
* [X] --version
* [X] Write help
17 changes: 16 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,23 @@ impl Output {
// display charactars as ^ which are not supported by the terminal
fn show_nonprinting(&mut self) {
if self.opt.nonPrint_and_showTabs || self.opt.nonPrint_and_showEnds || self.opt.non_printing
if self.opt.non_print_and_show_tabs
|| self.opt.non_print_and_show_ends
|| self.opt.non_printing
{
()
for line in self.out.iter_mut() {
//line.retain(|c| c.is_ascii());
let mut temp = String::new();
for c in &mut line.chars() {
if c.is_ascii() {
temp.push(c);
} else {
temp.push_str("^?");
// TODO call helper function to represent the character correctly
}
}
*line = temp;
}
}
}

Expand Down

0 comments on commit 9d2cd99

Please sign in to comment.