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
[WIP] Multiple buffers #40
Conversation
SwitchToBuffer(usize), | ||
} | ||
|
||
fn try_get_buffer_command(c: &str) -> Option<BufferCommand> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is a little odd IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I wrote it expecting that I would need special logic to handle the buffer commands that take a buffer id with them (like b{n}
does). That's the only one that needs it now. Do you think I should just move this logic down into the call site?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, yeah, perhaps.
What a suprise to wake up to. Beautiful work! I left some nitpicks. |
let cursor = self.cursor().clone(); | ||
self.cursors.insert(self.current_cursor as usize, cursor); | ||
let current_cursor_index = self.buffers.current_buffer_info().current_cursor as usize; | ||
self.buffers.current_buffer_info_mut().cursors.insert(current_cursor_index, cursor); | ||
self.next_cursor(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think I should move cursor()
, next_cursor()
and prev_cursor()
into BufferInfo
? If I did that, then I could pull self.buffers.current_buffer_info_mut()
into a local. It doesn't work now because of the borrow checker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I think BufferInfo
should be renamed to Buffer
and then place this kind of stuff in it, since that would be more descriptive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good idea. Right now there is a Buffer
trait that the SplitBuffer
implements. Should I rename it or leave it?
Thank you! Are there any other commands I should implement? |
I think we're good for now. Very awesome work! |
Thanks! |
Awesome! Will merge. |
Related to #24
Here's what's currently implemented:
o file
opens the file in a new bufferls
lists the available buffers in a new bufferb{n}
switches to the specified bufferI still need to:
help.txt
bd
to remove the current bufferI'd appreciate feedback on the code and\or the features.
Thanks!