Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

editor: Reduce selection opacity when editor is not focused (#40925)

Smit Barmase2096f256f2ba
diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs
index b5c1fecbea0..efb0bf9a1e5 100644
--- a/crates/editor/src/element.rs
+++ b/crates/editor/src/element.rs
@@ -1422,7 +1422,11 @@ impl EditorElement {
layouts.push(layout);
}
- let player = editor.current_user_player_color(cx);
+ let mut player = editor.current_user_player_color(cx);
+ if !editor.is_focused(window) {
+ const UNFOCUS_EDITOR_SELECTION_OPACITY: f32 = 0.5;
+ player.selection = player.selection.opacity(UNFOCUS_EDITOR_SELECTION_OPACITY);
+ }
selections.push((player, layouts));
if let SelectionDragState::Dragging {