Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic implementation of multi buffer editor #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dunkyp
Copy link

@dunkyp dunkyp commented Oct 9, 2017

This is more of an RFC, it implements multiple buffers using a std::vector. There are a few changes I'd be interested in making but wanted to see what your preferred approach would be. For instance I'm assigning a numerical id to buffers, it'd probably be better to use a unique id (perhaps based on a uuid) and place the buffers into a map. I've also added a default scratch buffer, which I thought would be useful if the intent is to include a scheme interpreter in the editor.

@arximboldi
Copy link
Owner

Wow, that's cool! I wanted to add this eventually so it's nice that someone is thinking about it too. I am still on a road-trip so I can't do a very thorough review, here are a couple of things I just saw:

  1. Instead of an std::vector I'd use an immer::vector (or maybe even an immer::flex_vector) but...
  2. ...I agree that a map is better than a vector. Immer now has an immer::map type. I'd suggest using a std::filesystem::path as the key (probably wrapped in an immer::box) using the std::filesystem::canonical(...) form of the path (unless the file does not exist). Then the order could be dealt with explicitly by using a float member (when placing a buffer between two other buffers you just need to set the order to some value between the order of those).
  3. From a style point of view, I am trying to use only free functions in the "data model" to keep things simple, so I'd change the current() method for a current_buffer free function.
  4. The tricky part down this road is to add commands similar to find-file or switch-to-buffer which open an interactive prompt in the mini-buffer. I have some ideas on how to do this but I do not have time to elaborate now...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants