Skip to content

Commit

Permalink
fix panic when searching
Browse files Browse the repository at this point in the history
  • Loading branch information
curlpipe committed Sep 7, 2024
1 parent 6c9755f commit 64196dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .todo.md
Original file line number Diff line number Diff line change
@@ -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?
Expand Down
4 changes: 4 additions & 0 deletions src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -680,13 +680,17 @@ impl Editor {
pub fn next_match(&mut self, target: &str) -> Option<String> {
let mtch = self.doc_mut().next_match(target, 1)?;
self.doc_mut().goto(&mtch.loc);
// Update highlighting
self.update_highlighter().ok()?;
Some(mtch.text)
}

/// Move to the previous match
pub fn prev_match(&mut self, target: &str) -> Option<String> {
let mtch = self.doc_mut().prev_match(target)?;
self.doc_mut().goto(&mtch.loc);
// Update highlighting
self.update_highlighter().ok()?;
Some(mtch.text)
}

Expand Down

0 comments on commit 64196dd

Please sign in to comment.