Caret: no blink-timer wakeups while a selection hides the caret (#9770)

The 530 ms blink repaint was scheduled whenever the editor had focus,
including when a text selection hides the caret, so an idle window with
text selected redrew about twice a second for nothing.


Claude-Session: https://claude.ai/code/session_01FypgCXNomWeGUu3duixKdm

Co-authored-by: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Martin Ball
2026-12-06 10:22:39 +00:00
committed by GitHub
co-authored by Claude Opus 5.5
parent b66f352171
commit eaf8c8256c
+1 -1
View File
@@ -214,7 +214,7 @@ pub(crate) fn paint_caret(app: &mut WordApp, ui: &mut Ui, pass: &ToolPass, body:
ctx.request_repaint();
} else if shown && animates(app, motion) && blink_fading(since_ms / 1000.0, app.canvas.glide.secs()) {
ctx.request_repaint_after(std::time::Duration::from_millis(16));
} else if active {
} else if shown {
ctx.request_repaint_after(std::time::Duration::from_millis(530 - (since_ms as u64 % 530)));
}
}