helix-term/command: make scratch buffer name consistent (#1071)

pull/1076/head
Cole Helbling 3 years ago committed by GitHub
parent ebc14d9d20
commit bf70cfd050
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -53,6 +53,8 @@ use grep_searcher::{sinks, BinaryDetection, SearcherBuilder};
use ignore::{DirEntry, WalkBuilder, WalkState}; use ignore::{DirEntry, WalkBuilder, WalkState};
use tokio_stream::wrappers::UnboundedReceiverStream; use tokio_stream::wrappers::UnboundedReceiverStream;
pub const SCRATCH_BUFFER_NAME: &str = "[scratch]";
pub struct Context<'a> { pub struct Context<'a> {
pub register: Option<char>, pub register: Option<char>,
pub count: Option<NonZeroUsize>, pub count: Option<NonZeroUsize>,
@ -1890,7 +1892,7 @@ mod cmd {
.map(|doc| { .map(|doc| {
doc.relative_path() doc.relative_path()
.map(|path| path.to_string_lossy().to_string()) .map(|path| path.to_string_lossy().to_string())
.unwrap_or_else(|| "[scratch]".into()) .unwrap_or_else(|| SCRATCH_BUFFER_NAME.into())
}) })
.collect(); .collect();
if !modified.is_empty() { if !modified.is_empty() {
@ -2616,7 +2618,7 @@ fn buffer_picker(cx: &mut Context) {
.map(helix_core::path::get_relative_path); .map(helix_core::path::get_relative_path);
let path = match path.as_deref().and_then(Path::to_str) { let path = match path.as_deref().and_then(Path::to_str) {
Some(path) => path, Some(path) => path,
None => return Cow::Borrowed("[scratch buffer]"), None => return Cow::Borrowed(SCRATCH_BUFFER_NAME),
}; };
let mut flags = Vec::new(); let mut flags = Vec::new();

Loading…
Cancel
Save