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 kyruzic committed Sep 27, 2024
1 parent 96fdfcc commit 3ef7982
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 3ef7982

Please sign in to comment.