cloud storage client
git clone https://git.lucas.co/cce-cloud.git
refactor: launcher text via the paint walk, not the getters (Phase 6aq)
jl.text_labels() / fuzzel.text_labels() become walk_text_labels(): the
paint walk's text prims reduced to the plain labels this renderer shapes
(make_text_buffer applies the control font and window bounds as before).
JsonLayout's page filter + checkbox side-labels ride its new
renders_own_subtree paint_self in cce-ui. Standalone A/B (daemon socket
held aside): fuzzel and --json both AE=0.
Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018u7qTwzX95dd5ysAkaSCLk
src/main.rs | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/src/main.rs b/src/main.rs
index 9687c60..a473497 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -144,6 +144,24 @@ fn make_text_buffer(font_system: &mut FontSystem, text: &str, size: f32) -> Buff
buffer
}
+/// A widget subtree's text via the paint walk (not the legacy text_labels getter),
+/// reduced to the plain labels this renderer shapes: the buffer font and window bounds
+/// stay exactly as before (make_text_buffer applies the control font to every label).
+fn walk_text_labels(ui: &cce_ui::context::UiContext, w: &dyn Element) -> Vec<TextLabel> {
+ let mut pc = cce_ui::scene::paint::PaintCtx::new();
+ cce_ui::scene::painter::append_widget_text(ui, w, &mut pc);
+ pc.finish()
+ .items
+ .into_iter()
+ .filter_map(|item| match item.prim {
+ cce_ui::scene::paint::Prim::Text { text, x, y, font_size, color, .. } => {
+ Some(TextLabel { text, x, y, font_size, color })
+ }
+ _ => None,
+ })
+ .collect()
+}
+
fn filter_and_sort_items(items: &[String], query: &str) -> Vec<String> {
if query.is_empty() {
return items.to_vec();
@@ -1377,6 +1395,7 @@ impl State {
ref fuzzel,
ref json_layout,
ref mode,
+ ref ui_context,
..
} = self;
@@ -1392,14 +1411,10 @@ impl State {
let is_json_mode = *mode == LauncherMode::Json;
if is_json_mode {
if let Some(jl) = json_layout {
- for label in jl.text_labels() {
- widget_labels.push(label);
- }
+ widget_labels.extend(walk_text_labels(ui_context, jl));
}
} else {
- for label in fuzzel.text_labels() {
- widget_labels.push(label);
- }
+ widget_labels.extend(walk_text_labels(ui_context, fuzzel));
}
for label in &widget_labels {