From c3a98b6a3e7102345af3c32599319bc870747d12 Mon Sep 17 00:00:00 2001 From: notoria Date: Thu, 3 Jun 2021 11:03:46 +0200 Subject: [PATCH] Highlight matching brackets --- helix-term/src/ui/editor.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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); + } + } + } } } }