Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: #391 [Editor] cursor always blinks even when not in focus #737

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading