aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCole Helbling2021-11-11 03:22:15 +0000
committerGitHub2021-11-11 03:22:15 +0000
commitbf70cfd050d961ce7b8d5a95fe663dff9eb1e66e (patch)
treef4207440d741c1ed14a9f6d368fe8182b0f7b82b
parentebc14d9d206a0960a97fd706bd8fbfbedf2fb203 (diff)
helix-term/command: make scratch buffer name consistent (#1071)
-rw-r--r--helix-term/src/commands.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 24c38dd5..23b385eb 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -53,6 +53,8 @@ use grep_searcher::{sinks, BinaryDetection, SearcherBuilder};
use ignore::{DirEntry, WalkBuilder, WalkState};
use tokio_stream::wrappers::UnboundedReceiverStream;
+pub const SCRATCH_BUFFER_NAME: &str = "[scratch]";
+
pub struct Context<'a> {
pub register: Option<char>,
pub count: Option<NonZeroUsize>,
@@ -1890,7 +1892,7 @@ mod cmd {
.map(|doc| {
doc.relative_path()
.map(|path| path.to_string_lossy().to_string())
- .unwrap_or_else(|| "[scratch]".into())
+ .unwrap_or_else(|| SCRATCH_BUFFER_NAME.into())
})
.collect();
if !modified.is_empty() {
@@ -2616,7 +2618,7 @@ fn buffer_picker(cx: &mut Context) {
.map(helix_core::path::get_relative_path);
let path = match path.as_deref().and_then(Path::to_str) {
Some(path) => path,
- None => return Cow::Borrowed("[scratch buffer]"),
+ None => return Cow::Borrowed(SCRATCH_BUFFER_NAME),
};
let mut flags = Vec::new();