Skip to content

Commit

Permalink
feat: truncated line indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
kabouzeid committed Jul 28, 2024
1 parent 51dc964 commit f347664
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,16 @@ fn fit_text(
}),
)
} else {
Either::Right(once(Line::raw(l.chars().take(cols).collect::<String>())))
let mut str = l.chars().take(cols + 1).collect::<String>();
if str.chars().count() > cols {
str.truncate(cols - 1);
Either::Right(once(Line::default().spans(vec![
Span::raw(str),
Span::styled("…", Style::default().add_modifier(Modifier::DIM)),
])))
} else {
Either::Right(once(Line::raw(str)))
}
};
match anchor {
ScrollAnchor::Top => Either::Left(iter),
Expand Down

0 comments on commit f347664

Please sign in to comment.