Merge pull request #80 from notoria/highlight

Highlight matching brackets
This commit is contained in:
Blaž Hrastnik 2021-06-03 22:14:37 +09:00 committed by GitHub
commit a05fb95769
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);
}
}
}
}
}
}