aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorMartin Junghanns2021-11-20 14:17:25 +0000
committerGitHub2021-11-20 14:17:25 +0000
commita3a3b0b517d0e690f3efc66b17ac7b9f769dba9d (patch)
tree6508de70a21a30b0ac88bbd7d619ac8540a2ac23 /helix-term
parentb95c9470de9f9199f109fdbfb6ec9a951fbe8866 (diff)
Jump to end char of surrounding pair from any cursor pos (#1121)
* Jump to end char of surrounding pair from any cursor pos * Separate bracket matching into exact and fuzzy search * Add constants for bracket chars * Abort early if char under cursor is not a bracket * Simplify bracket char validation * Refactor node search and unify find methods * Remove bracket constants
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/commands.rs4
-rw-r--r--helix-term/src/ui/editor.rs2
2 files changed, 4 insertions, 2 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 431265cd..e70773eb 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -4954,7 +4954,9 @@ fn match_brackets(cx: &mut Context) {
if let Some(syntax) = doc.syntax() {
let text = doc.text().slice(..);
let selection = doc.selection(view.id).clone().transform(|range| {
- if let Some(pos) = match_brackets::find(syntax, doc.text(), range.anchor) {
+ if let Some(pos) =
+ match_brackets::find_matching_bracket_fuzzy(syntax, doc.text(), range.anchor)
+ {
range.put_cursor(text, pos, doc.mode == Mode::Select)
} else {
range
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index 03cd0474..27d33d22 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -377,7 +377,7 @@ impl EditorView {
use helix_core::match_brackets;
let pos = doc.selection(view.id).primary().cursor(text);
- let pos = match_brackets::find(syntax, doc.text(), pos)
+ let pos = match_brackets::find_matching_bracket(syntax, doc.text(), pos)
.and_then(|pos| view.screen_coords_at_pos(doc, text, pos));
if let Some(pos) = pos {