changeset 5821:47119a752f29

Only pluralise "buffer" when required (#11018) * Only pluralise buffer when required * Use == 1 instead of != 1
author Thomas Schafer <54135831+thomasschafer@users.noreply.github.com>
date Wed, 26 Jun 2024 22:03:21 +0100
parents 874af2f63fb9
children a79ec6225ddb
files helix-term/src/commands/typed.rs
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/helix-term/src/commands/typed.rs	Tue Jun 25 23:22:20 2024 +0900
+++ b/helix-term/src/commands/typed.rs	Wed Jun 26 22:03:21 2024 +0100
@@ -164,9 +164,10 @@
             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 @@
             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(())