cargo fmt: the Retired, F6 and appearance commits left four files unformatted, failing CI's crate job

This commit is contained in:
ZacharyZhang-NY committed 2026-10-08 21:45:51 -04:00
1 parent 69265b4fd4
commit cbf63c6945
5 files changed
+47 -11

No files matched your search

+2 -2
View File
@@ -3,8 +3,8 @@ use std::{rc::Rc, time::Duration};
use gpui::{
Anchor, Animation, AnimationExt, AnyElement, App, ClickEvent, Context, ElementId, Entity,
FontWeight, HoverListenerMode, InteractiveElement, IntoElement, ParentElement, Pixels,
RenderOnce, Role, SharedString, StatefulInteractiveElement, Styled, Task, Window, anchored, canvas,
div, point, prelude::*, relative,
RenderOnce, Role, SharedString, StatefulInteractiveElement, Styled, Task, Window, anchored,
canvas, div, point, prelude::*, relative,
};
use web_time::Instant;
+4 -1
View File
@@ -22,7 +22,10 @@ impl Retired {
/// Frees images no one else holds; call while painting.
pub fn release(&mut self, window: &mut Window) {
// A shared image may still be drawn; it waits.
let (free, held): (Vec<_>, Vec<_>) = self.0.drain(..).partition(|image| Arc::strong_count(image) == 1);
let (free, held): (Vec<_>, Vec<_>) = self
.0
.drain(..)
.partition(|image| Arc::strong_count(image) == 1);
self.0 = held;
for image in free {
if let Err(error) = window.drop_image(image) {
+27 -7
View File
@@ -191,7 +191,9 @@ impl Render for Kept {
.key_context("HostField")
.track_focus(&self.field)
.size(px(100.0))
.on_action(move |_: &Indent, _, cx| view.update(cx, |kept, _| kept.indents += 1)),
.on_action(move |_: &Indent, _, cx| {
view.update(cx, |kept, _| kept.indents += 1)
}),
)
.child(div().track_focus(&self.after).size(px(100.0)))
}
@@ -216,7 +218,11 @@ fn f6_leaves_a_field_that_keeps_tab(cx: &mut TestAppContext) {
cx.simulate_keystrokes("tab");
let after = view.read_with(cx, |kept, _| kept.after.clone());
cx.simulate_keystrokes("f6");
assert_eq!(view.read_with(cx, |kept, _| kept.indents), 1, "Tab stayed in the field");
assert_eq!(
view.read_with(cx, |kept, _| kept.indents),
1,
"Tab stayed in the field"
);
cx.update(|window, _| assert!(after.is_focused(window), "F6 moved on"));
cx.simulate_keystrokes("shift-f6");
let field = view.read_with(cx, |kept, _| kept.field.clone());
@@ -238,7 +244,9 @@ impl Render for Painted {
view.update(cx, |painted, _| {
painted.retired.release(window);
if let Some(image) = painted.image.clone() {
window.paint_image(bounds, bounds, Default::default(), image, 0, false).expect("paints");
window
.paint_image(bounds, bounds, Default::default(), image, 0, false)
.expect("paints");
}
})
},
@@ -252,7 +260,10 @@ fn a_retired_image_is_freed_at_the_next_paint(cx: &mut TestAppContext) {
cx.update(Theme::init);
let pixels = image::RgbaImage::from_pixel(2, 2, image::Rgba([1, 2, 3, 255]));
let image = std::sync::Arc::new(gpui::RenderImage::new([image::Frame::new(pixels)]));
let (view, cx) = cx.add_window_view(|_, _| Painted { image: Some(image), retired: super::Retired::default() });
let (view, cx) = cx.add_window_view(|_, _| Painted {
image: Some(image),
retired: super::Retired::default(),
});
cx.run_until_parked();
view.update(cx, |painted, cx| {
let old = painted.image.take().expect("painted");
@@ -260,7 +271,10 @@ fn a_retired_image_is_freed_at_the_next_paint(cx: &mut TestAppContext) {
cx.notify();
});
cx.run_until_parked();
assert!(view.read_with(cx, |painted, _| painted.retired.is_empty()), "the old image was freed");
assert!(
view.read_with(cx, |painted, _| painted.retired.is_empty()),
"the old image was freed"
);
// One still held elsewhere waits until it is let go.
let pixels = image::RgbaImage::from_pixel(2, 2, image::Rgba([4, 5, 6, 255]));
let shared = std::sync::Arc::new(gpui::RenderImage::new([image::Frame::new(pixels)]));
@@ -269,9 +283,15 @@ fn a_retired_image_is_freed_at_the_next_paint(cx: &mut TestAppContext) {
cx.notify();
});
cx.run_until_parked();
assert!(!view.read_with(cx, |painted, _| painted.retired.is_empty()), "a held image waits");
assert!(
!view.read_with(cx, |painted, _| painted.retired.is_empty()),
"a held image waits"
);
drop(shared);
view.update(cx, |_, cx| cx.notify());
cx.run_until_parked();
assert!(view.read_with(cx, |painted, _| painted.retired.is_empty()), "then it is freed");
assert!(
view.read_with(cx, |painted, _| painted.retired.is_empty()),
"then it is freed"
);
}
+3 -1
View File
@@ -75,7 +75,9 @@ impl RenderOnce for ThemeSelector {
.iter()
.fold(
SegmentedControl::new(self.id, *words),
|control, (_, words, icon)| control.segment(*words, i18n::text(cx, words, &[]), Some(*icon)),
|control, (_, words, icon)| {
control.segment(*words, i18n::text(cx, words, &[]), Some(*icon))
},
)
.on_change(move |value, window, cx| {
let (chosen, _, _) = Appearance::ALL
+11
View File
@@ -12,3 +12,14 @@
- [x] G7 Issue #6: `shell::ColumnShell`, a sidebar that runs to the window's top with the traffic lights, beside one or two panes that bring their own headers; tested
- [x] G8 Issue #6: a Layout story, `stories.json`, AGENTS.md and the PRD line; the story runs live on the site
- [x] G9 Push, deploy, reply on #6 and #7, close #6
# GitHub round, 2026-10-08
- [x] G10 CI: `cargo fmt` on the files the last commits left unformatted
- [ ] G11 Issue #7: a caret is a whole number of device pixels wide at a device pixel, so it never shows thin then thick; tested
- [ ] G12 Issue #7: an IME asks for its candidate box past the laid-out text; the box clamps to the last layout, as `bounds_for` does; tested
- [ ] G13 Issue #12: a floating option list occludes, so the wheel scrolls the list and not the page under it; tested
- [ ] G14 Issue #7: BlockEditor scrolls in its own `ScrollArea` with its scrollbar and keeps the caret in view as blocks are added; tested
- [ ] G15 Issue #7: BlockEditor turns into Markdown and back; tested
- [ ] G16 Issue #7: a selection across blocks: drag or Shift-press selects, copy, cut, delete and typing act on it, undo restores; tested
- [ ] G17 Push, reply on #7 and #12