Skip to content
Snippets Groups Projects
Commit 6beb7194 authored by Wesley Wiser's avatar Wesley Wiser
Browse files

Add buffer delete command

parent f6f4c18d
No related branches found
No related tags found
No related merge requests found
...@@ -62,6 +62,11 @@ impl Editor { ...@@ -62,6 +62,11 @@ impl Editor {
self.buffers.switch_to(new_buffer_index); self.buffers.switch_to(new_buffer_index);
self.redraw_task = RedrawTask::Full; self.redraw_task = RedrawTask::Full;
}, },
"bd" => {
let ix = self.buffers.current_buffer_index();
self.buffers.delete_buffer(ix);
self.redraw_task = RedrawTask::Full;
},
"help" => { "help" => {
self.open("/apps/sodium/help.txt"); self.open("/apps/sodium/help.txt");
}, },
......
...@@ -89,6 +89,11 @@ impl BufferManager { ...@@ -89,6 +89,11 @@ impl BufferManager {
self.buffers.len() self.buffers.len()
} }
/// Gets the index of the current buffer.
pub fn current_buffer_index(&self) -> usize {
self.current_buffer_index
}
/// Get a reference to the currently open buffer. /// Get a reference to the currently open buffer.
pub fn current_buffer(&self) -> &SplitBuffer { pub fn current_buffer(&self) -> &SplitBuffer {
&self.current_buffer_info().raw_buffer &self.current_buffer_info().raw_buffer
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment