From 6ed0d0cd39d40a9ed3a693c0473499a71ea6f152 Mon Sep 17 00:00:00 2001 From: Thomas Schafer <54135831+thomasschafer@users.noreply.github.com> Date: Wed, 26 Jun 2024 22:03:21 +0100 Subject: [PATCH] Only pluralise "buffer" when required (#11018) * Only pluralise buffer when required * Use == 1 instead of != 1 --- helix-term/src/commands/typed.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 652106bd2..ab12fab10 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -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, ); } @@ -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(())