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.

Fix macOS IME overlay positioning (#21416)

Conrad Irwin7c4082478350
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index d5d96436e88..51a90a9206c 100644
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@ -14611,7 +14611,8 @@ impl ViewInputHandler for Editor {
let start = OffsetUtf16(range_utf16.start).to_display_point(&snapshot);
let x = snapshot.x_for_display_point(start, &text_layout_details) - scroll_left
- + self.gutter_dimensions.width;
+ + self.gutter_dimensions.width
+ + self.gutter_dimensions.margin;
let y = line_height * (start.row().as_f32() - scroll_position.y);
Some(Bounds {
diff --git a/crates/gpui/src/platform/mac/window.rs b/crates/gpui/src/platform/mac/window.rs
index f430af7495f..12a332e9bc4 100644
--- a/crates/gpui/src/platform/mac/window.rs
+++ b/crates/gpui/src/platform/mac/window.rs
@@ -1701,7 +1701,10 @@ extern "C" fn first_rect_for_character_range(
let lock = state.lock();
let mut frame = NSWindow::frame(lock.native_window);
let content_layout_rect: CGRect = msg_send![lock.native_window, contentLayoutRect];
- frame.origin.y -= frame.size.height - content_layout_rect.size.height;
+ let style_mask: NSWindowStyleMask = msg_send![lock.native_window, styleMask];
+ if !style_mask.contains(NSWindowStyleMask::NSFullSizeContentViewWindowMask) {
+ frame.origin.y -= frame.size.height - content_layout_rect.size.height;
+ }
frame
};
with_input_handler(this, |input_handler| {