Avoid trailing s in message when only 1 file is opened (#5189)

This commit is contained in:
Nick 2022-12-23 19:43:05 +05:30 committed by GitHub
parent b1ca7ddf89
commit 24c3b00d10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -227,7 +227,11 @@ pub fn new(
doc.set_selection(view_id, pos); doc.set_selection(view_id, pos);
} }
} }
editor.set_status(format!("Loaded {} files.", nr_of_files)); editor.set_status(format!(
"Loaded {} file{}.",
nr_of_files,
if nr_of_files == 1 { "" } else { "s" } // avoid "Loaded 1 files." grammo
));
// align the view to center after all files are loaded, // align the view to center after all files are loaded,
// does not affect views without pos since it is at the top // does not affect views without pos since it is at the top
let (view, doc) = current!(editor); let (view, doc) = current!(editor);