From 6235716beb5d94a45c42a38eb5b5bc27c6c6e961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Sat, 16 Sep 2023 15:57:41 +0200 Subject: [PATCH] Make `Edit::copy_selection` immutable --- src/edit/editor.rs | 2 +- src/edit/mod.rs | 2 +- src/edit/syntect.rs | 2 +- src/edit/vi.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/edit/editor.rs b/src/edit/editor.rs index 2374ab8..4277ae1 100644 --- a/src/edit/editor.rs +++ b/src/edit/editor.rs @@ -109,7 +109,7 @@ impl Edit for Editor { } } - fn copy_selection(&mut self) -> Option { + fn copy_selection(&self) -> Option { let select = self.select_opt?; let (start, end) = match select.line.cmp(&self.cursor.line) { diff --git a/src/edit/mod.rs b/src/edit/mod.rs index 77e07e3..1c16746 100644 --- a/src/edit/mod.rs +++ b/src/edit/mod.rs @@ -115,7 +115,7 @@ pub trait Edit { fn shape_as_needed(&mut self, font_system: &mut FontSystem); /// Copy selection - fn copy_selection(&mut self) -> Option; + fn copy_selection(&self) -> Option; /// Delete selection, adjusting cursor and returning true if there was a selection // Also used by backspace, delete, insert, and enter when there is a selection diff --git a/src/edit/syntect.rs b/src/edit/syntect.rs index 62e9352..8eda391 100644 --- a/src/edit/syntect.rs +++ b/src/edit/syntect.rs @@ -250,7 +250,7 @@ impl<'a> Edit for SyntaxEditor<'a> { self.editor.shape_as_needed(font_system); } - fn copy_selection(&mut self) -> Option { + fn copy_selection(&self) -> Option { self.editor.copy_selection() } diff --git a/src/edit/vi.rs b/src/edit/vi.rs index b0309aa..4d5fd89 100644 --- a/src/edit/vi.rs +++ b/src/edit/vi.rs @@ -81,7 +81,7 @@ impl<'a> Edit for ViEditor<'a> { self.editor.shape_as_needed(font_system); } - fn copy_selection(&mut self) -> Option { + fn copy_selection(&self) -> Option { self.editor.copy_selection() }