on master help sign in
helix-term/commands: display buffer id in picker
a1207fdCole Helbling
helix-term/src/commands.rs+2−2
@@ -3385,7 +3385,7 @@ fn buffer_picker(cx: &mut Context) {
3385 .map(helix_core::path::get_relative_path);
3385 .map(helix_core::path::get_relative_path);
3386 let path = match path.as_deref().and_then(Path::to_str) {
3386 let path = match path.as_deref().and_then(Path::to_str) {
3387 Some(path) => path,
3387 Some(path) => path,
3388− None => return Cow::Borrowed(SCRATCH_BUFFER_NAME),
3388+ None => SCRATCH_BUFFER_NAME,
3389 };
3389 };
3390
3390
3391 let mut flags = Vec::new();
3391 let mut flags = Vec::new();
@@ -3401,7 +3401,7 @@ fn buffer_picker(cx: &mut Context) {
3401 } else {
3401 } else {
3402 format!(" ({})", flags.join(""))
3402 format!(" ({})", flags.join(""))
3403 };
3403 };
3404− Cow::Owned(format!("{}{}", path, flag))
3404+ Cow::Owned(format!("{} {}{}", self.id, path, flag))
3405 }
3405 }
3406 }
3406 }
3407
3407
helix-view/src/lib.rs+6
@@ -26,6 +26,12 @@ impl Default for DocumentId {
26 }
26 }
27}
27}
28
28
29+impl std::fmt::Display for DocumentId {
30+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
31+ f.write_fmt(format_args!("{}", self.0))
32+ }
33+}
34+
29slotmap::new_key_type! {
35slotmap::new_key_type! {
30 pub struct ViewId;
36 pub struct ViewId;
31}
37}