on master help sign in
Loop around the end on regex searches.
commit9ca2909c80ff95b1dd4a1d92b7144d7bbfce3ca6 authorBlaž Hrastnik <blaz@mxxn.io> dateThu 8 Apr 2021, 15:58 (6 years ago) parent8b33ba2
4 files changed+10−4
.gitmodules+3 TODO.md+1−2 helix-syntax/nvim-treesitter+1 helix-term/src/commands.rs+5−2
.gitmodules+3
@@ -82,3 +82,6 @@
8282 path = helix-syntax/languages/tree-sitter-toml
8383 url = https://github.com/ikatyang/tree-sitter-toml
8484 shallow = true
85+[submodule "helix-syntax/nvim-treesitter"]
86+ path = helix-syntax/nvim-treesitter
87+ url = https://github.com/nvim-treesitter/nvim-treesitter
TODO.md+1−2
@@ -27,7 +27,6 @@
2727
2828- [ ] regex search / select next
2929- [ ] = for auto indent line/selection
30−- [ ] yank on delete
3130- [ ] :x for closing buffers
3231
3332- [x] jumplist (push selections on goto / select on the view)
@@ -59,7 +58,7 @@
5958- [ ] macro recording
6059- [x] tab completion for paths on the prompt
6160- [ ] extend selection (treesitter select parent node) (replaces viw, vi(, va( etc )
62−- [ ] bracket pairs
61+- [x] bracket pairs
6362- [x] comment block (gcc)
6463- [ ] completion signature popups/docs
6564- [ ] selection align
helix-syntax/nvim-treesitternew file+1

Submodule changed.

helix-term/src/commands.rs+5−2
@@ -612,8 +612,11 @@ fn _search(doc: &mut Document, view_id: ViewId, contents: &str, regex: &Regex) {
612612 let text = doc.text();
613613 let start = doc.selection(view_id).cursor();
614614
615− // TODO: use find_at to find the next match after the cursor, loop around the end
616− if let Some(mat) = regex.find_at(contents, start) {
615+ // use find_at to find the next match after the cursor, loop around the end
616+ let mat = regex
617+ .find_at(contents, start)
618+ .or_else(|| regex.find(contents));
619+ if let Some(mat) = mat {
617620 let start = text.byte_to_char(mat.start());
618621 let end = text.byte_to_char(mat.end());
619622 let selection = Selection::single(start, end - 1);