Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Update rendering of gutter diff hunks to show whether a hunk is staged or not (#26809)
Jakub Charvat7c1405db3794
diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rsindex 812cf3c1437..3095f77862d 100644--- a/crates/editor/src/element.rs+++ b/crates/editor/src/element.rs@@ -4376,7 +4376,9 @@ impl EditorElement {}),};- if let Some((hunk_bounds, background_color, corner_radii, _)) = hunk_to_paint {+ if let Some((hunk_bounds, background_color, corner_radii, status)) = hunk_to_paint {+ let unstaged = status.has_secondary_hunk();+// Flatten the background color with the editor color to prevent// elements below transparent hunks from showing throughlet flattened_background_color = cx@@ -4385,13 +4387,29 @@ impl EditorElement {.editor_background.blend(background_color);- window.paint_quad(quad(- hunk_bounds,- corner_radii,- flattened_background_color,- Edges::default(),- transparent_black(),- ));+ if unstaged {+ window.paint_quad(quad(+ hunk_bounds,+ corner_radii,+ flattened_background_color,+ Edges::default(),+ transparent_black(),+ ));+ } else {+ let flattened_unstaged_background_color = cx+ .theme()+ .colors()+ .editor_background+ .blend(background_color.opacity(0.3));++ window.paint_quad(quad(+ hunk_bounds,+ corner_radii,+ flattened_unstaged_background_color,+ Edges::all(Pixels(1.0)),+ flattened_background_color,+ ));+ }}}});