diff options
| author | tslil <tslil@posteo.de> | 2025-10-22 21:02:01 +0100 |
|---|---|---|
| committer | tslil <tslil@posteo.de> | 2025-10-22 21:52:43 +0100 |
| commit | 20674aa65148558fb849eb1bb9c8a5e4a0cf483d (patch) | |
| tree | d2b54ae8b20ca0a7041b9d29f19f50944f47ed35 /rprt-engine/src/state.rs | |
| parent | 9f3e21628231f3fa91ab8ff45872a76e7e11fcc4 (diff) | |
Implement two basic selection functions
Diffstat (limited to 'rprt-engine/src/state.rs')
| -rw-r--r-- | rprt-engine/src/state.rs | 12 |
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) { |
