Disrupt blink for immediate feedback on cursor shape changes (#14177)

# Issue

When a user does something that changes the cursor shape, such as when
switching between vim modes, there may be an up to 500ms (cursor blink
interval) delay until the user receives feedback for their action. This
happens when the shape change happens during the invisible phase of a
blink - the user will not see the cursor shape change until the next
phase, which could be 500ms away.

# Solution

Cursor shape changes should disrupt blinking by forcing the cursor to be
shown, this results in immediate feedback for shape changes. This is in
line with the behavior of other editors I've tried.

Release Notes:

- Improved visual feedback when changing cursor shape
This commit is contained in:
Omer Tuchfeld 2024-07-11 20:47:10 +02:00 committed by GitHub
parent e51d469025
commit 3541a1175f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2163,6 +2163,10 @@ impl Editor {
pub fn set_cursor_shape(&mut self, cursor_shape: CursorShape, cx: &mut ViewContext<Self>) {
self.cursor_shape = cursor_shape;
// Disrupt blink for immediate user feedback that the cursor shape has changed
self.blink_manager.update(cx, BlinkManager::show_cursor);
cx.notify();
}