From 20674aa65148558fb849eb1bb9c8a5e4a0cf483d Mon Sep 17 00:00:00 2001 From: tslil Date: Wed, 22 Oct 2025 21:02:01 +0100 Subject: Implement two basic selection functions --- rprt-engine/src/state.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'rprt-engine/src/state.rs') 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, buffer_to_file: HashMap>, @@ -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) { -- cgit v1.2.3