Finder buffer work
This commit is contained in:
1 parent
e995551d2f
commit
7ad0aa0530
3 files changed
+32
-7
No files matched your search
+7
-1
@@ -18,6 +18,7 @@ use crate::{
|
||||
configuration::Configuration,
|
||||
core::{
|
||||
actions::{CommandAction, EditorAction},
|
||||
buffer::FinderBuffer,
|
||||
error::BasicErrorKind,
|
||||
pane_layout::PaneDescriptor,
|
||||
},
|
||||
@@ -231,8 +232,13 @@ impl EditorCore {
|
||||
//TODO change this hardcoding of the buffer id
|
||||
let buffer_id = BufferId(100);
|
||||
if toggle {
|
||||
//TODO create finder buffer
|
||||
let buffer = Buffer::Finder(FinderBuffer::new());
|
||||
self.buffers.insert(buffer_id, buffer);
|
||||
let descriptor = PaneDescriptor::Floating;
|
||||
self.pane_layout.add(buffer_id, descriptor);
|
||||
} else {
|
||||
self.buffers.remove(&buffer_id);
|
||||
self.pane_layout.remove(buffer_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+15
-2
@@ -15,8 +15,21 @@ pub(crate) struct BufferId(pub(crate) usize);
|
||||
|
||||
pub(crate) enum Buffer {
|
||||
Text(TextBuffer),
|
||||
#[allow(dead_code)]
|
||||
Dummy,
|
||||
Finder(FinderBuffer),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct FinderBuffer {
|
||||
title: Option<String>,
|
||||
pub(crate) input_buffer: Option<String>,
|
||||
}
|
||||
impl FinderBuffer {
|
||||
pub(crate) fn new() -> Self {
|
||||
Self {
|
||||
title: None,
|
||||
input_buffer: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//TODO make these settings nonpublic, except for some setting that indicates style
|
||||
|
||||
+10
-4
@@ -117,10 +117,16 @@ impl TerminalState {
|
||||
}
|
||||
|
||||
if let Some(floating) = pane_layout.has_popup() {
|
||||
if let Some(Buffer::Text(floating_buf)) = core.get_buffer_by_id(floating) {
|
||||
self.render_popup(frame, rect, floating_buf);
|
||||
} else {
|
||||
warn!(id=?floating, "Buffer not found");
|
||||
let buf = core.get_buffer_by_id(floating);
|
||||
match buf {
|
||||
Some(Buffer::Text(floating)) => self.render_popup(frame, rect, floating),
|
||||
Some(Buffer::Finder(finder)) => {
|
||||
warn!("NOT DONE");
|
||||
//self.render_popup(frame, rect, floating)
|
||||
}
|
||||
None => {
|
||||
warn!(id=?floating, "Buffer not found");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user