aboutsummaryrefslogtreecommitdiff
path: root/rprt-engine/src/state.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rprt-engine/src/state.rs')
-rw-r--r--rprt-engine/src/state.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/rprt-engine/src/state.rs b/rprt-engine/src/state.rs
index bc6fbb6..68283d0 100644
--- a/rprt-engine/src/state.rs
+++ b/rprt-engine/src/state.rs
@@ -65,7 +65,7 @@ impl StateChange {
#[derive(Debug)]
pub struct EditorState {
- current_buffer: BufferID,
+ pub current_buffer_id: BufferID,
current_selection: Selection,
buffers: HashMap<BufferID, Buffer>,
buffer_to_file: HashMap<BufferID, Option<PathBuf>>,
@@ -76,7 +76,7 @@ pub struct EditorState {
impl EditorState {
pub fn new() -> Self {
Self {
- current_buffer: 0,
+ current_buffer_id: 0,
current_selection: Selection::empty(),
buffers: HashMap::new(),
buffer_to_file: HashMap::new(),
@@ -106,12 +106,12 @@ impl EditorState {
buffer_id
}
- pub fn get_buffer(&self, buffer_id: BufferID) -> Option<&Buffer> {
- self.buffers.get(&buffer_id)
+ pub fn current_buffer(&self) -> Option<&Buffer> {
+ self.buffers.get(&self.current_buffer_id)
}
- pub fn get_buffer_mut(&mut self, buffer_id: BufferID) -> Option<&mut Buffer> {
- self.buffers.get_mut(&buffer_id)
+ pub fn get_buffer(&self, buffer_id: BufferID) -> Option<&Buffer> {
+ self.buffers.get(&buffer_id)
}
pub fn commit(&mut self, change: StateChange) {