diff options
author | Dan Davison <dandavison7@gmail.com> | 2020-08-14 12:10:52 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-14 12:10:52 -0400 |
commit | d4441fe24a36b1134b110680283929ec4fb23d24 (patch) | |
tree | ce171b1e9ecd39e55087ecd100c5e34f0f753b55 /src/delta.rs | |
parent | de114e3ea52c82ab92f4cc52aefaf76e027a3f07 (diff) |
Truncate long lines (#290)
Fixes #154, #288
Diffstat (limited to 'src/delta.rs')
-rw-r--r-- | src/delta.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/delta.rs b/src/delta.rs index dee3afef..33c205cf 100644 --- a/src/delta.rs +++ b/src/delta.rs @@ -78,6 +78,11 @@ where while let Some(Ok(raw_line_bytes)) = lines.next() { let raw_line = String::from_utf8_lossy(&raw_line_bytes); + let raw_line = if config.max_line_length > 0 && raw_line.len() > config.max_line_length { + ansi::truncate_str(&raw_line, config.max_line_length, &config.truncation_symbol) + } else { + raw_line + }; let line = ansi::strip_ansi_codes(&raw_line).to_string(); if source == Source::Unknown { source = detect_source(&line); |