Do not blink the cursor if Zed window is focused away

co-authored-by: Max <max@zed.dev>
This commit is contained in:
Kirill Bulatov 2023-08-29 20:32:24 +03:00
parent dd577074f2
commit 100870aa9c
2 changed files with 18 additions and 5 deletions

View file

@ -1454,6 +1454,16 @@ impl Editor {
cx.observe(&display_map, Self::on_display_map_changed),
cx.observe(&blink_manager, |_, _, cx| cx.notify()),
cx.observe_global::<SettingsStore, _>(Self::settings_changed),
cx.observe_window_activation(|editor, active, cx| {
editor.blink_manager.update(cx, |blink_manager, cx| {
if active {
blink_manager.enable(cx);
} else {
blink_manager.show_cursor(cx);
blink_manager.disable(cx);
}
});
}),
],
};