Loop around the end on regex searches.

imgbot
Blaž Hrastnik 3 years ago
parent 8b33ba2284
commit 9ca2909c80

3
.gitmodules vendored

@ -82,3 +82,6 @@
path = helix-syntax/languages/tree-sitter-toml
url = https://github.com/ikatyang/tree-sitter-toml
shallow = true
[submodule "helix-syntax/nvim-treesitter"]
path = helix-syntax/nvim-treesitter
url = https://github.com/nvim-treesitter/nvim-treesitter

@ -27,7 +27,6 @@
- [ ] regex search / select next
- [ ] = for auto indent line/selection
- [ ] yank on delete
- [ ] :x for closing buffers
- [x] jumplist (push selections on goto / select on the view)
@ -59,7 +58,7 @@
- [ ] macro recording
- [x] tab completion for paths on the prompt
- [ ] extend selection (treesitter select parent node) (replaces viw, vi(, va( etc )
- [ ] bracket pairs
- [x] bracket pairs
- [x] comment block (gcc)
- [ ] completion signature popups/docs
- [ ] selection align

@ -0,0 +1 @@
Subproject commit 1f00ecdfa36ef5e43a4feaf189e8c2c003118c00

@ -612,8 +612,11 @@ fn _search(doc: &mut Document, view_id: ViewId, contents: &str, regex: &Regex) {
let text = doc.text();
let start = doc.selection(view_id).cursor();
// TODO: use find_at to find the next match after the cursor, loop around the end
if let Some(mat) = regex.find_at(contents, start) {
// use find_at to find the next match after the cursor, loop around the end
let mat = regex
.find_at(contents, start)
.or_else(|| regex.find(contents));
if let Some(mat) = mat {
let start = text.byte_to_char(mat.start());
let end = text.byte_to_char(mat.end());
let selection = Selection::single(start, end - 1);

Loading…
Cancel
Save