mirror of
https://github.com/helix-editor/helix.git
synced 2025-01-19 13:37:06 +04:00
helix-term/command: make scratch buffer name consistent (#1071)
This commit is contained in:
parent
ebc14d9d20
commit
bf70cfd050
@ -53,6 +53,8 @@
|
|||||||
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 @@ pub(super) fn buffers_remaining_impl(editor: &mut Editor) -> anyhow::Result<()>
|
|||||||
.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 format(&self) -> Cow<str> {
|
|||||||
.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…
Reference in New Issue
Block a user