summaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorRyan Geary <rtgnj42@gmail.com>2022-04-23 17:50:06 -0400
committerRyan Geary <7076013+theryangeary@users.noreply.github.com>2022-04-23 18:19:10 -0400
commit0400bf6ce4ae30dcc852c9d05e24482fabb200b3 (patch)
tree090d9ca3561fcb5d1a0687ea1b6a530a7e558461 /src/main.rs
parentbd32530e84c960897c56f856448c93e0480ffc4d (diff)
Fix field separator issue with no EOF
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 9b511a7..07f66d1 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -73,7 +73,9 @@ fn main_generic<W: WriteReceiver>(opt: Opt, handle: &mut W) -> Result<()> {
while let Some(line) = reader.read_line(&mut buffer) {
match line {
Ok(l) => {
- let l = if config.opt.character_wise || config.opt.field_separator.is_some() {
+ let l = if (config.opt.character_wise || config.opt.field_separator.is_some())
+ && l.ends_with("\n")
+ {
&l[0..l.len().saturating_sub(1)]
} else {
&l