Skip to content

Commit

Permalink
Fix macOS IME overlay positioning (#21416)
Browse files Browse the repository at this point in the history
Release Notes:

- Improved positioning of macOS IME overlay

---------

Co-authored-by: Richard Feldman <richard@zed.dev>
  • Loading branch information
ConradIrwin and rtfeldman authored Dec 2, 2024
1 parent 4e12f05 commit 7c40824
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion crates/editor/src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 4 additions & 1 deletion crates/gpui/src/platform/mac/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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| {
Expand Down

0 comments on commit 7c40824

Please sign in to comment.