on master help sign in
helix-term/commands: display buffer id in picker
commita1207fd7683c2e038df923704bb5790c6cdaefea authorCole Helbling <cole.e.helbling@outlook.com> dateTue 9 Nov 2021, 17:06 (5 years ago) parentd11b652
2 files changed+8−2
helix-term/src/commands.rs+2−2 helix-view/src/lib.rs+6
helix-term/src/commands.rs+2−2
@@ -3385,7 +3385,7 @@ fn buffer_picker(cx: &mut Context) {
33853385 .map(helix_core::path::get_relative_path);
33863386 let path = match path.as_deref().and_then(Path::to_str) {
33873387 Some(path) => path,
3388− None => return Cow::Borrowed(SCRATCH_BUFFER_NAME),
3388+ None => SCRATCH_BUFFER_NAME,
33893389 };
33903390
33913391 let mut flags = Vec::new();
@@ -3401,7 +3401,7 @@ fn buffer_picker(cx: &mut Context) {
34013401 } else {
34023402 format!(" ({})", flags.join(""))
34033403 };
3404− Cow::Owned(format!("{}{}", path, flag))
3404+ Cow::Owned(format!("{} {}{}", self.id, path, flag))
34053405 }
34063406 }
34073407
helix-view/src/lib.rs+6
@@ -26,6 +26,12 @@ impl Default for DocumentId {
2626 }
2727}
2828
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+
2935slotmap::new_key_type! {
3036 pub struct ViewId;
3137}