Skip to content

Commit

Permalink
Only pluralise "buffer" when required (helix-editor#11018)
Browse files Browse the repository at this point in the history
* Only pluralise buffer when required

* Use == 1 instead of != 1
  • Loading branch information
thomasschafer authored and mxxntype committed Aug 14, 2024
1 parent 04fd2b6 commit 5c0c23b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions helix-term/src/commands/typed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,10 @@ fn buffer_close_by_ids_impl(
cx.editor.switch(*first, Action::Replace);
}
bail!(
"{} unsaved buffer(s) remaining: {:?}",
"{} unsaved buffer{} remaining: {:?}",
modified_names.len(),
modified_names
if modified_names.len() == 1 { "" } else { "s" },
modified_names,
);
}

Expand Down Expand Up @@ -658,9 +659,10 @@ pub(super) fn buffers_remaining_impl(editor: &mut Editor) -> anyhow::Result<()>
editor.switch(*first, Action::Replace);
}
bail!(
"{} unsaved buffer(s) remaining: {:?}",
"{} unsaved buffer{} remaining: {:?}",
modified_names.len(),
modified_names
if modified_names.len() == 1 { "" } else { "s" },
modified_names,
);
}
Ok(())
Expand Down

0 comments on commit 5c0c23b

Please sign in to comment.