Skip to content

Commit 3ef7982

Browse files
thomasschaferkyruzic
authored andcommitted
Only pluralise "buffer" when required (helix-editor#11018)
* Only pluralise buffer when required * Use == 1 instead of != 1
1 parent 96fdfcc commit 3ef7982

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

helix-term/src/commands/typed.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,10 @@ fn buffer_close_by_ids_impl(
164164
cx.editor.switch(*first, Action::Replace);
165165
}
166166
bail!(
167-
"{} unsaved buffer(s) remaining: {:?}",
167+
"{} unsaved buffer{} remaining: {:?}",
168168
modified_names.len(),
169-
modified_names
169+
if modified_names.len() == 1 { "" } else { "s" },
170+
modified_names,
170171
);
171172
}
172173

@@ -658,9 +659,10 @@ pub(super) fn buffers_remaining_impl(editor: &mut Editor) -> anyhow::Result<()>
658659
editor.switch(*first, Action::Replace);
659660
}
660661
bail!(
661-
"{} unsaved buffer(s) remaining: {:?}",
662+
"{} unsaved buffer{} remaining: {:?}",
662663
modified_names.len(),
663-
modified_names
664+
if modified_names.len() == 1 { "" } else { "s" },
665+
modified_names,
664666
);
665667
}
666668
Ok(())

0 commit comments

Comments
 (0)