Unique tab names#113
Conversation
|
Maybe truncate middle of path if there is a naming collision > 2 levels?
Becomes |
|
I'll take a look, sounds like good ideas. I honestly didn't discover the repo nickname until you mentioned it. Could maybe be more visible? Right click on a tab -> nickname? |
b7047c9 to
f4d4c4e
Compare
|
I implemented that identical parents should be hidden with the ellipsis character ("..."), and the home "~" char is used where appropriate. Repo nicknames are preferred if they are set. Disambiguated names will not override nicknames. However, two things to keep in mind:
|
| path1 = os.path.join(tempDir.name, "a", "repo") | ||
| path2 = os.path.join(tempDir.name, "b", "repo") |
There was a problem hiding this comment.
Wrap these two in os.path.realpath(...) and I think the test will pass on macOS
(On macOS tempDir.name is typically in /var/folders/..., realpath() turns that into /private/var/folders/..., and repo nicknames depend on "real" paths)
There was a problem hiding this comment.
it's never an issue in real use? Could always patch so symlinks is looked at when looking up nicknames
There was a problem hiding this comment.
Repo paths that you open from the GUI or pass on the CLI all go through MainWindow._resolveWorkdir. This resolves the real path of the corresponding workdir (via pygit2).
So, by the time a user gets to set the nickname in the GUI, the real path has already been resolved. It's only an issue in unit tests where _resolveWorkdir is bypassed.
When multiple tabs are open with the same name, use parent folder names to create unique tab names. E.g. two repos in folders "work/a/app" and "work/b/app" will be named "a/app" and "b/app". If parents have identical names, look upward in the tree until unique parent name can be found and hide identical parts with ellipsis. Notes: * Duplicate nicknames are allowed, as nicknames are always preferred over unique tab names. * A repo which has a name that conflicts with another repo's nickname will not be renamed.
f4d4c4e to
64d3b52
Compare
|
Currently, |
|
Hmm. It's a tricky one. Right now it's based on fixed depth formatting, so all matches get ellipses or none do. The quickest fix would be to name them |
|
Working on a patch for mixed depth matching, but it's a tough beast to slay. Lots of edge cases. Hoping to have something by the weekend. |
|
Sorry I left you hanging, I think we can merge your current implementation as it is, because it's already an improvement over no disambiguation. For more complicated cases, I'll make the nickname feature easier to discover. I'll be happy to review if you come up with something better, but what we have now is shippable. Thank you! |
|
No problem. I'll put up a second PR when I have a suggestion for an improvement |
Feedback request for a suggestion:
When multiple tabs are open with the same name, use parent folder names to create unique tab names.
I work in products that have a structured multi-repo layout, where one repo is always named "app", another is always named "tests", and so on. Most of the time I have several of these open at the same time. This can cause confusion.
Suggestion: Include parent folder names if tabs have identical names. Two parent levels are used. If they are identical, tabs will be named with an alphabetical prefix "A: tab", "B: tab" etc.
Examples:
Lots of questions: