From 64196dd7248dfe965edd347629619c2a3ee84ad5 Mon Sep 17 00:00:00 2001 From: Luke <11898833+curlpipe@users.noreply.github.com> Date: Sat, 7 Sep 2024 12:15:45 +0100 Subject: [PATCH] fix panic when searching --- .todo.md | 3 ++- src/editor.rs | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.todo.md b/.todo.md index 02a0ac1..d611536 100644 --- a/.todo.md +++ b/.todo.md @@ -1,8 +1,9 @@ - [ ] General bug fixes - [ ] Search needs to break beyond what has been loaded into buffer* - 7th - [ ] Fix multi spaces not registering as tabs* - 8th + - [ ] Also investigate the cursor being able to jump out of bounds after a tab character at the end of a line - [ ] Find out where tab info goes and how it's used - - [ ] Show as tabs but be spaces on the backen + - [ ] Show as tabs but be spaces on the backend - [ ] Cursor movement improvement - 8th - [ ] Fully understand the desired behaviour - [ ] Where is this activity defined? diff --git a/src/editor.rs b/src/editor.rs index 58760f5..0ec5da2 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -680,6 +680,8 @@ impl Editor { pub fn next_match(&mut self, target: &str) -> Option { let mtch = self.doc_mut().next_match(target, 1)?; self.doc_mut().goto(&mtch.loc); + // Update highlighting + self.update_highlighter().ok()?; Some(mtch.text) } @@ -687,6 +689,8 @@ impl Editor { pub fn prev_match(&mut self, target: &str) -> Option { let mtch = self.doc_mut().prev_match(target)?; self.doc_mut().goto(&mtch.loc); + // Update highlighting + self.update_highlighter().ok()?; Some(mtch.text) }