Re-re-fork (#23)

This commit is contained in:
Miles Wirht
2026-03-22 12:21:07 -04:00
committed by GitHub
parent 18aeb44a54
commit de080b0773
246 changed files with 34208 additions and 11176 deletions
+5 -5
View File
@@ -29,7 +29,7 @@ impl Example {
];
let focus_handle = cx.focus_handle();
window.focus(&focus_handle);
window.focus(&focus_handle, cx);
Self {
focus_handle,
@@ -40,13 +40,13 @@ impl Example {
}
}
fn on_tab(&mut self, _: &Tab, window: &mut Window, _: &mut Context<Self>) {
window.focus_next();
fn on_tab(&mut self, _: &Tab, window: &mut Window, cx: &mut Context<Self>) {
window.focus_next(cx);
self.message = SharedString::from("Pressed Tab - focus-visible border should appear!");
}
fn on_tab_prev(&mut self, _: &TabPrev, window: &mut Window, _: &mut Context<Self>) {
window.focus_prev();
fn on_tab_prev(&mut self, _: &TabPrev, window: &mut Window, cx: &mut Context<Self>) {
window.focus_prev(cx);
self.message =
SharedString::from("Pressed Shift-Tab - focus-visible border should appear!");
}
+10 -3
View File
@@ -546,8 +546,15 @@ impl Element for TextElement {
window.paint_quad(selection)
}
let line = prepaint.line.take().unwrap();
line.paint(bounds.origin, window.line_height(), window, cx)
.unwrap();
line.paint(
bounds.origin,
window.line_height(),
gpui::TextAlign::Left,
None,
window,
cx,
)
.unwrap();
if focus_handle.is_focused(window)
&& let Some(cursor) = prepaint.cursor.take()
@@ -736,7 +743,7 @@ fn main() {
window
.update(cx, |view, window, cx| {
window.focus(&view.text_input.focus_handle(cx));
window.focus(&view.text_input.focus_handle(cx), cx);
cx.activate(true);
})
.unwrap();
+2 -2
View File
@@ -55,7 +55,7 @@ fn main() {
cx.activate(false);
cx.new(|cx| {
let focus_handle = cx.focus_handle();
focus_handle.focus(window);
focus_handle.focus(window, cx);
ExampleWindow { focus_handle }
})
},
@@ -72,7 +72,7 @@ fn main() {
|window, cx| {
cx.new(|cx| {
let focus_handle = cx.focus_handle();
focus_handle.focus(window);
focus_handle.focus(window, cx);
ExampleWindow { focus_handle }
})
},
+2 -2
View File
@@ -4,7 +4,7 @@ use std::path::PathBuf;
use anyhow::Result;
use gpui::{
App, Application, AssetSource, Bounds, Context, SharedString, Window, WindowBounds,
WindowOptions, div, prelude::*, px, rgb, size, svg,
WindowOptions, current_platform, div, prelude::*, px, rgb, size, svg,
};
struct Assets {
@@ -68,7 +68,7 @@ impl Render for SvgExample {
}
fn main() {
Application::new()
Application::with_platform(current_platform(false))
.with_assets(Assets {
base: PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("examples"),
})
+5 -5
View File
@@ -22,7 +22,7 @@ impl Example {
];
let focus_handle = cx.focus_handle();
window.focus(&focus_handle);
window.focus(&focus_handle, cx);
Self {
focus_handle,
@@ -31,13 +31,13 @@ impl Example {
}
}
fn on_tab(&mut self, _: &Tab, window: &mut Window, _: &mut Context<Self>) {
window.focus_next();
fn on_tab(&mut self, _: &Tab, window: &mut Window, cx: &mut Context<Self>) {
window.focus_next(cx);
self.message = SharedString::from("You have pressed `Tab`.");
}
fn on_tab_prev(&mut self, _: &TabPrev, window: &mut Window, _: &mut Context<Self>) {
window.focus_prev();
fn on_tab_prev(&mut self, _: &TabPrev, window: &mut Window, cx: &mut Context<Self>) {
window.focus_prev(cx);
self.message = SharedString::from("You have pressed `Shift-Tab`.");
}
}
+3 -3
View File
@@ -1,6 +1,6 @@
use gpui::{
App, Application, Bounds, Context, KeyBinding, PromptButton, PromptLevel, Timer, Window,
WindowBounds, WindowKind, WindowOptions, actions, div, prelude::*, px, rgb, size,
App, Application, Bounds, Context, KeyBinding, PromptButton, PromptLevel, Window, WindowBounds,
WindowKind, WindowOptions, actions, div, prelude::*, px, rgb, size,
};
struct SubWindow {
@@ -188,7 +188,7 @@ impl Render for WindowDemo {
// Restore the application after 3 seconds
window
.spawn(cx, async move |cx| {
Timer::after(std::time::Duration::from_secs(3)).await;
smol::Timer::after(std::time::Duration::from_secs(3)).await;
cx.update(|_, cx| {
cx.activate(false);
})