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.

macos: Honor "Tiled windows have margins" for the Fill titlebar action (#63759)

Romain Ollierc7801b0c447c
diff --git a/crates/gpui_macos/src/window.rs b/crates/gpui_macos/src/window.rs
index 88a694c9714..d8f5b3c8781 100644
--- a/crates/gpui_macos/src/window.rs
+++ b/crates/gpui_macos/src/window.rs
@@ -1978,9 +1978,16 @@ impl PlatformWindow for MacWindow {
}
}
"Fill" => {
- // There is no documented API for "Fill" action, so we'll just zoom the window
if is_resizable {
- window.zoom_(nil);
+ // Unlike `zoom:`, AppKit's private Fill action honors the system's
+ // "Tiled windows have margins" setting.
+ let responds_to_zoom_fill: BOOL =
+ msg_send![window, respondsToSelector: sel!(_zoomFill:)];
+ if responds_to_zoom_fill == YES {
+ let _: () = msg_send![window, _zoomFill: nil];
+ } else {
+ window.zoom_(nil);
+ }
}
}
_ => {