Add an input example to gpui (#13534)

Add a single-line text input example to gpui

(I'm hoping to be able to debug keyboard issues without rebuilding the
whole
app every time)

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin 2024-06-25 22:06:50 -06:00 committed by GitHub
parent eb914682b3
commit b43df6048b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 503 additions and 3 deletions

View file

@ -1672,9 +1672,13 @@ extern "C" fn first_rect_for_character_range(
range: NSRange,
_: id,
) -> NSRect {
let frame = unsafe {
let window = get_window_state(this).lock().native_window;
NSView::frame(window)
let frame: NSRect = unsafe {
let state = get_window_state(this);
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;
frame
};
with_input_handler(this, |input_handler| {
input_handler.bounds_for_range(range.to_range()?)