I first explored the idea of presenting a single file in multiple columns like a newspaper. Source code is often aligned to relatively tight widths because it is easier to scan vertically than to scan lines of greatly varying varying width. Most text editors and IDEs are set up to show one file and switch between them. Even though IDEs like Visual Studio technically allow multiple files, the arrangement of these is such a pain that it remains easier to treat them the same way - a single active file at a time. If we have one file open, with a tight column width then we’re not using a sizeable portion of a widescreen monitor. The column approach allowed a much denser display but felt strange to navigate. I abandoned this approach early to concentrate on the second idea but I had considered allowing the whole view to scroll horizontally and to adjust the scrolling to work on whole pages rather than lines.
The next idea was an attempt to use the second half of the widescreen to combine the idea of multiple buffers with easy access to pertinent parts of the code base. I decided at some point to call these “portals”. Each portal is a live view into a fixed section of a file. If I insert text in the document above the section of the portal then the portal stays as it is and is effectively shunted down. If I make changes inside a portal then these are reflected into the main document. I envisage navigating the code pulling the key parts into portals and then performing a task, readily switching between the different portals as the code grows organically in each area.
I learned that writing a basic functioning text editor is much more straightforward than I had imagined. I think that there was enough in the feel of editing using portals to consider developing the text editor further to become my daily driver (much easier than making a generally available editor!)
Things I’d want to try next…
- Use Odin’s parser to find functions and add the ability to create portals from a “Jump to definition”.
- Figure out a way to manage the portals well when you have more larger portals
- Add the ability to have portals into different files
- Consider whether inline portals work (I.e you “goto definition” in place - like VS Code Peek Definition but persistent in that location in the file).