on master help sign in
helix-term/command: make scratch buffer name consistent (#1071)
commitbf70cfd050d961ce7b8d5a95fe663dff9eb1e66e authorCole Helbling <cole.e.helbling@outlook.com> dateWed 10 Nov 2021, 19:22 (5 years ago) parentebc14d9
1 file changed+4−2
helix-term/src/commands.rs+4−2
helix-term/src/commands.rs+4−2
@@ -53,6 +53,8 @@ use grep_searcher::{sinks, BinaryDetection, SearcherBuilder};
5353use ignore::{DirEntry, WalkBuilder, WalkState};
5454use tokio_stream::wrappers::UnboundedReceiverStream;
5555
56+pub const SCRATCH_BUFFER_NAME: &str = "[scratch]";
57+
5658pub struct Context<'a> {
5759 pub register: Option<char>,
5860 pub count: Option<NonZeroUsize>,
@@ -1890,7 +1892,7 @@ mod cmd {
18901892 .map(|doc| {
18911893 doc.relative_path()
18921894 .map(|path| path.to_string_lossy().to_string())
1893− .unwrap_or_else(|| "[scratch]".into())
1895+ .unwrap_or_else(|| SCRATCH_BUFFER_NAME.into())
18941896 })
18951897 .collect();
18961898 if !modified.is_empty() {
@@ -2616,7 +2618,7 @@ fn buffer_picker(cx: &mut Context) {
26162618 .map(helix_core::path::get_relative_path);
26172619 let path = match path.as_deref().and_then(Path::to_str) {
26182620 Some(path) => path,
2619− None => return Cow::Borrowed("[scratch buffer]"),
2621+ None => return Cow::Borrowed(SCRATCH_BUFFER_NAME),
26202622 };
26212623
26222624 let mut flags = Vec::new();