diff options
author | Wojciech Kępka | 2021-06-08 04:08:28 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-06-08 08:23:05 +0000 |
commit | 1bffb34350343eb6887e32c7fbe1d51e9fce858e (patch) | |
tree | f991127ed8abf8b53eda9d6ebf65a44e1c6c7c35 /helix-term/src | |
parent | c978d811d96d03acf04ddbe5af66fff57c17e287 (diff) |
Make matching bracket dimmed, prevent out of bounds rendering
Diffstat (limited to 'helix-term/src')
-rw-r--r-- | helix-term/src/ui/editor.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index c34b6cb6..92913701 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -334,11 +334,13 @@ impl EditorView { if let Some(pos) = pos { let pos = view.screen_coords_at_pos(doc, text, pos); if let Some(pos) = pos { - // this only prevents panic due to painting selection too far - // TODO: prevent painting when scroll past x or in gutter - // TODO: use a more correct width check - if (pos.col as u16) < viewport.width { - let style = Style::default().add_modifier(Modifier::REVERSED); + if (pos.col as u16) < viewport.width + view.first_col as u16 + && pos.col >= view.first_col + { + let style = Style::default() + .add_modifier(Modifier::REVERSED) + .add_modifier(Modifier::DIM); + surface .get_mut( viewport.x + pos.col as u16, |