summaryrefslogtreecommitdiff
path: root/helix-term/src/ui/editor.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-06-03 13:14:37 +0000
committerGitHub2021-06-03 13:14:37 +0000
commita05fb95769abe950aa5f8131fdf097933590d00f (patch)
tree8fc1d21484ced21d984cd9f9630a250ea7c4894a /helix-term/src/ui/editor.rs
parent74e4ac8d499360bcf381527c8d8c84c6837ce1cb (diff)
parentc3a98b6a3e7102345af3c32599319bc870747d12 (diff)
Merge pull request #80 from notoria/highlight
Highlight matching brackets
Diffstat (limited to 'helix-term/src/ui/editor.rs')
-rw-r--r--helix-term/src/ui/editor.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index bd7846a4..15e64b72 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -306,6 +306,20 @@ impl EditorView {
),
cursor_style,
);
+ if let Some(syntax) = doc.syntax() {
+ use helix_core::match_brackets;
+ let pos = doc.selection(view.id).cursor();
+ let pos = match_brackets::find(syntax, doc.text(), pos);
+ if let Some(pos) = pos {
+ let pos = view.screen_coords_at_pos(doc, text, pos);
+ if let Some(pos) = pos {
+ let style = Style::default().add_modifier(Modifier::REVERSED);
+ surface
+ .get_mut(pos.col as u16 + OFFSET, pos.row as u16)
+ .set_style(style);
+ }
+ }
+ }
}
}
}