Skip to content

Commit

Permalink
Fix snippet alignment + hide empty snippets (#316)
Browse files Browse the repository at this point in the history
  • Loading branch information
denisidoro committed Mar 26, 2020
1 parent 69f09e8 commit ec1ca87
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/display.rs
Expand Up @@ -51,7 +51,7 @@ pub fn preview(comment: &str, tags: &str, snippet: &str) {

fn limit_str(text: &str, length: usize) -> String {
if text.len() > length {
format!("{}…", text.chars().take(length).collect::<String>())
format!("{}…", text.chars().take(length - 1).collect::<String>())
} else {
format!("{:width$}", text, width = length)
}
Expand Down
2 changes: 1 addition & 1 deletion src/parser.rs
Expand Up @@ -117,7 +117,7 @@ fn write_cmd(
comment_width: usize,
stdin: &mut std::process::ChildStdin,
) -> Result<(), Error> {
if snippet.is_empty() {
if snippet.len() <= 1 {
Ok(())
} else {
stdin
Expand Down

0 comments on commit ec1ca87

Please sign in to comment.