ui: Simplify conditional

pull/373/head^2
Blaž Hrastnik 3 years ago
parent bcca152ad5
commit 82fc28a0ce

@ -361,15 +361,15 @@ impl EditorView {
if let Some(syntax) = doc.syntax() { if let Some(syntax) = doc.syntax() {
use helix_core::match_brackets; use helix_core::match_brackets;
let pos = doc.selection(view.id).cursor(); let pos = doc.selection(view.id).cursor();
let pos = match_brackets::find(syntax, doc.text(), pos); let pos = match_brackets::find(syntax, doc.text(), pos)
if let Some(pos) = pos { .and_then(|pos| view.screen_coords_at_pos(doc, text, pos));
let pos = view.screen_coords_at_pos(doc, text, pos);
if let Some(pos) = pos { if let Some(pos) = pos {
// ensure col is on screen
if (pos.col as u16) < viewport.width + view.first_col as u16 if (pos.col as u16) < viewport.width + view.first_col as u16
&& pos.col >= view.first_col && pos.col >= view.first_col
{ {
let style = let style = theme.try_get("ui.cursor.match").unwrap_or_else(|| {
theme.try_get("ui.cursor.match").unwrap_or_else(|| {
Style::default() Style::default()
.add_modifier(Modifier::REVERSED) .add_modifier(Modifier::REVERSED)
.add_modifier(Modifier::DIM) .add_modifier(Modifier::DIM)
@ -388,7 +388,6 @@ impl EditorView {
} }
} }
} }
}
pub fn render_diagnostics( pub fn render_diagnostics(
&self, &self,

Loading…
Cancel
Save