Skip to content

Commit

Permalink
fix: #391 [Editor] cursor always blinks even when not in focus
Browse files Browse the repository at this point in the history
  • Loading branch information
KhodyrevDS committed Jan 19, 2025
1 parent bd92509 commit 1d23c05
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/views/editor/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,7 @@ impl EditorView {

pub fn paint_text(
cx: &mut PaintCx,
view_id: &ViewId,
ed: &Editor,
viewport: Rect,
is_active: bool,
Expand Down Expand Up @@ -761,7 +762,10 @@ impl EditorView {
}
}

Self::paint_cursor_caret(cx, ed, is_active, screen_lines);
let is_cursor_visible = cx.app_state.is_focused(view_id);
if (is_cursor_visible) {
Self::paint_cursor_caret(cx, ed, is_active, screen_lines);
}

for (line, y) in screen_lines.iter_lines_y() {
let text_layout = ed.text_layout(line);
Expand Down Expand Up @@ -897,6 +901,7 @@ impl View for EditorView {
let screen_lines = ed.screen_lines.get_untracked();
EditorView::paint_text(
cx,
&self.id(),
&ed,
viewport,
self.is_active.get_untracked(),
Expand Down

0 comments on commit 1d23c05

Please sign in to comment.