bim
bim copied to clipboard
Implement viewports / splits
There's technically nothing really stopping us from showing multiple views of the same open file, to allow for things like splits, but there's some rendering and mouse input handling to worry about. We'll probably want to disable scrolling, or look into supporting scroll regions in ToaruOS's terminal as well...
I have a rudimentary implementation of basic left-right splits. Currently only works when two buffers are open, and the split viewport will be between those two buffers (so at the moment, you can't have the same file on both sides).
Another hack for having a split view on the same file has been added, and I've spent some time thinking about how to correctly handle all of this moving forward.
- A new concept of
view
should be added. A view is over a particular buffer and is managed by some sort of layout system.views
will have cursor locations, offsets, and a physical location on the screen. The layout engine will manage resizing views appropriately to fit the screen. In theory, more than two views should be supported with various split modes (vertical, horizontal, etc.). - Accesses to the global
env
(active buffer) should be removed. Methods should take a buffer (env) to operate on. When they need to perform redraws, they should query the layout manager to determine which views use that buffer. - Mouse handler should mostly be dealing with views and less with buffers.
- The layout manager needs to understand tabs probably?