aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-04-08 06:58:20 +0000
committerBlaž Hrastnik2021-04-08 13:34:06 +0000
commit9ca2909c80ff95b1dd4a1d92b7144d7bbfce3ca6 (patch)
tree098185e6b0150f180691e2f7d5df36c077bb50cd
parent8b33ba2284f88bea4c6144364d75189255466661 (diff)
Loop around the end on regex searches.
-rw-r--r--.gitmodules3
-rw-r--r--TODO.md3
m---------helix-syntax/nvim-treesitter0
-rw-r--r--helix-term/src/commands.rs7
4 files changed, 9 insertions, 4 deletions
diff --git a/.gitmodules b/.gitmodules
index f4d6456c..3cfb7b56 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -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
diff --git a/TODO.md b/TODO.md
index 9561660e..00855ac9 100644
--- a/TODO.md
+++ b/TODO.md
@@ -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
diff --git a/helix-syntax/nvim-treesitter b/helix-syntax/nvim-treesitter
new file mode 160000
+Subproject 1f00ecdfa36ef5e43a4feaf189e8c2c003118c0
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 2e205fa6..0cbc3f9d 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -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);