Differentiate among tabs with the same name
This commit introduces a new, optional `Item::tab_description` method that lets implementers define a description for the tab with a certain `detail`. When two or more tabs match the same description, we will increase the `detail` until tabs don't match anymore or increasing the `detail` doesn't disambiguate tabs any further. As soon as we find a valid `detail` that disambiguates tabs enough, we will pass it to `Item::tab_content`. In `Editor`, this is implemented by showing more and more of the path's suffix as `detail` is increased.
This commit is contained in:
parent
4a5b8fd2e6
commit
07d269234f
12 changed files with 171 additions and 25 deletions
|
@ -20,7 +20,7 @@ use std::{
|
|||
any::Any,
|
||||
cmp::{self, Ordering},
|
||||
collections::{BTreeMap, HashMap},
|
||||
ffi::OsString,
|
||||
ffi::OsStr,
|
||||
future::Future,
|
||||
iter::{self, Iterator, Peekable},
|
||||
mem,
|
||||
|
@ -185,7 +185,7 @@ pub trait File: Send + Sync {
|
|||
|
||||
/// Returns the last component of this handle's absolute path. If this handle refers to the root
|
||||
/// of its worktree, then this method will return the name of the worktree itself.
|
||||
fn file_name(&self, cx: &AppContext) -> OsString;
|
||||
fn file_name<'a>(&'a self, cx: &'a AppContext) -> &'a OsStr;
|
||||
|
||||
fn is_deleted(&self) -> bool;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue