View without new tab to support floating layout
Hey 👋🏾
I'm thinking of writing a custom layout using floating windows for a range file history. So I was looking a bit into the code and trying to understand the construct of view, layout, windows etc. But if I'm not mistaken any layout will first open a new tab. Is that correct? And if so, would it be possible to make this optional?
The abstraction hierarchy goes like this (simplified):
View
├─ Panel
└─ FileEntry
└─ Layout
└─ Window
└─ File
Where:
View: is an abstract container for UI elements (panels, and diff layouts), tied to a tab page. Manages a collection ofFileEntry's.Panel's: are the various interactive UI buffers, like the file-panel, and the file-history-panel.FileEntry: is a container that manages the different versions of a file associated with a VCS revision (old state, new state, different versions of a file during a conflict). Holds an association to a layout (diff2, diff3, diff4, etc...), with which the various versions of this file will be displayed.Layout: Is a collection ofWindow's arranged in a particular way. The layouts control and manage how the windows are arranged.Window: Is a small abstraction around a normal vim window. Holds a reference to aFile.File: VCS oriented abstraction around a vim buffer. Produces and manages a buffer from a reference to a VCS object (i.e. a git object revision).
Without looking too deeply into it, I predict that what you're trying to implement would require a rather complicated refactor. The root of the abstraction is tied to the choice of using tab pages as the fundamental container for the windows that comprise the interface.
Definitely feel free to explore the viability of implementing your idea, but please discuss implementation details with me before putting a lot of work into this. I feel like I would need to see a strong argument for why this would be a valuable inclusion before a refactor of this complexity is to be considered.
Thank you very much for your fast and informative answer! 🙏
Yes, I looked into the code and saw this structure you draw. And also that the root view class has a hard coded command to always open a new tab first. Thereby the title. I thought about making his step optional/interchangeable. But I understand that this might be strong assumption for everything that builds on top of it. I'll look a bit more into the details of your architecture and see if I can come up with a proposal.
About having a good reason: I guess that could be argued. I believe to have an idea for a nice layout within a floating window. And I would love to build it on top of your great work instead of a complete new plugin. So far this is only a wild idea and it wouldn't be worth a new plugin nor to put too big refactoring on your plugin.
Thank you very much. I might post update or future questions here. ✌