texstudio
texstudio copied to clipboard
FR: Add minimal part of path to get unique tab names
Describe the feature and the current behavior/state
If you open two (or more) files with the same filename you cannot tell which one is which by just looking at the tabs. Hovering works as there is a tool tip with the complete path, but I sometimes have quite a few files open that happens to have the same name (today it was old exams and whoever added them put the date information in the directory name instead and called the actual file exam.tex, but there are sometimes other examples, paper.tex etc).
Who will benefit with this feature?
Everyone who doesn't bother to always come up with unique file names for their files.
Any Other info
The Python editor Spyder has this feature (and many other editors). Here is the relevant file there for reference:
https://github.com/spyder-ide/spyder/blob/eaa0e0315f64152ab0103834fbc169b838ab18f8/spyder/utils/sourcecode.py
disambiguate_fname takes a list with complete paths to all open files and the complete path of the file to find a unique name for and returns a minimal part of the path to disambiguate all the files. Naturally some of these things can be sped up by keeping track of things and not recreating it, but it is not a noticeable performance issue when executing it in Python, so adapting it to C++, well, should work quite OK.
I know this problem, too. On the other hand the width of the tabs shouldn't be to large. #2089 suggests multiple tab lines, so long tab names wouldn't be such a big issue. People should have an option if they like to have unique tab names. Maybe we could make the tab names editable or colourable? Maybe you could use split view, if you have two places from where your docs come from?