ChrisPenner / rasa

Extremely modular text editor built in Haskell
GNU General Public License v3.0
616 stars 42 forks source link

Add Viewports and rendering preferences #18

Closed ChrisPenner closed 7 years ago

ChrisPenner commented 7 years ago

This adds a new extension which provides a specification format for Viewports/Windows and adds commands for scrolling/changing viewport size/changing visible buffers.

I'm still working on adding the actions, but at present it can show several splits and scroll active panes; I'm going to get it functional then see about doing some refactorings to clean it up.

At this point we'll need to start considering how Extensions will refer to specific buffers, using an index into the list of buffers isn't scalable or appropriate (but still works for now)

Here's a few splits with different scroll points into the same buffer:

image

Scrolling is currently expressed as a simple integer offset from the first line of the buffer to the top of the viewport (it can be negative). Other techniques (like centering lines on screen; e.g. zz zt etc. from vim) will be accomplished through 'callbacks' that can accept the size of the viewport and the current scroll offset and return a new scroll offset.

Still some work to do! Let me know what you think about the approach!