Rename rest to leftover
The length kind that asks for a part of what is left once the fixed lengths are taken is called leftover: Len::leftover(2), Len::LEFTOVER, Size::LEFTOVER, Len::leftover the field, and apply_leftover. It says what it is where "rest" reads as "the remainder of the list" as often as "the remaining space", and every agent who has touched this has reached for a third word for it. Locals called rest that meant a region or a widget are renamed with it, since the word now names something else. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9644971daf
commit
691e3eb23c
16 files changed
+98
-89
No files matched your search
+12
-12
@@ -43,11 +43,11 @@ fn counted(h: &mut Harness, size: Size, dependence: OnResize) -> (WeakWidget<Cou
|
||||
(id, Counts(draws))
|
||||
}
|
||||
|
||||
/// A fixed-width leaf beside one that takes the rest, so changing the first
|
||||
/// hands the second a different box without the output changing.
|
||||
fn pair(h: &mut Harness, rest: OnResize) -> (WeakWidget<Counted>, Counts, WidgetId) {
|
||||
/// A fixed-width leaf beside one that takes what is left over, so changing
|
||||
/// the first hands the second a different box without the output changing.
|
||||
fn pair(h: &mut Harness, leftover: OnResize) -> (WeakWidget<Counted>, Counts, WidgetId) {
|
||||
let (first, _) = counted(h, Size::from((100, 200)), OnResize::Translate);
|
||||
let (second, draws) = counted(h, Size::REST, rest);
|
||||
let (second, draws) = counted(h, Size::LEFTOVER, leftover);
|
||||
h.set_root((first, second).span(Dir::RIGHT));
|
||||
(first, draws, second.id())
|
||||
}
|
||||
@@ -119,7 +119,7 @@ fn a_span_relays_out_when_a_child_it_measured_changes() {
|
||||
fn a_repaint_that_keeps_its_size_does_not_relay_out() {
|
||||
let mut h = Harness::new((400, 200));
|
||||
let (first, draws) = counted(&mut h, Size::from((100, 200)), OnResize::Translate);
|
||||
let (second, _) = counted(&mut h, Size::REST, OnResize::Translate);
|
||||
let (second, _) = counted(&mut h, Size::LEFTOVER, OnResize::Translate);
|
||||
h.set_root((first, second).span(Dir::RIGHT));
|
||||
let settled = draws.get();
|
||||
|
||||
@@ -158,7 +158,7 @@ impl Widget for FromHint {
|
||||
let mut region = UiRegion::FULL;
|
||||
region.y.end = region.y.start.offset(len.px);
|
||||
painter.widget_within(&self.inner, region);
|
||||
Size::REST
|
||||
Size::LEFTOVER
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ impl Widget for ReadsWidth {
|
||||
#[test]
|
||||
fn a_resize_does_not_redraw_what_the_shader_can_move() {
|
||||
let mut h = Harness::new((400, 200));
|
||||
let (leaf, draws) = counted(&mut h, Size::REST, OnResize::Scale);
|
||||
let (leaf, draws) = counted(&mut h, Size::LEFTOVER, OnResize::Scale);
|
||||
h.set_root(leaf);
|
||||
let settled = draws.get();
|
||||
|
||||
@@ -236,7 +236,7 @@ fn a_resize_does_not_redraw_what_the_shader_can_move() {
|
||||
#[test]
|
||||
fn a_resize_redraws_what_does_not_scale() {
|
||||
let mut h = Harness::new((400, 200));
|
||||
let (leaf, draws) = counted(&mut h, Size::REST, OnResize::Redraw);
|
||||
let (leaf, draws) = counted(&mut h, Size::LEFTOVER, OnResize::Redraw);
|
||||
h.set_root(leaf);
|
||||
let settled = draws.get();
|
||||
|
||||
@@ -430,8 +430,8 @@ fn a_widened_row_redraws_what_reads_its_length_and_nothing_else() {
|
||||
let mut h = Harness::new((400, 200));
|
||||
// What a transcript row is: something whose shaping depends on the width
|
||||
// it is given, beside something that only has to be the right shape.
|
||||
let (wraps, wrap_draws) = counted(&mut h, Size::REST, OnResize::Redraw);
|
||||
let (backing, back_draws) = counted(&mut h, Size::REST, OnResize::Scale);
|
||||
let (wraps, wrap_draws) = counted(&mut h, Size::LEFTOVER, OnResize::Redraw);
|
||||
let (backing, back_draws) = counted(&mut h, Size::LEFTOVER, OnResize::Scale);
|
||||
let row = (backing, wraps).span(Dir::RIGHT).add(&mut h.rsc);
|
||||
let bar = rect(Color::RED).width(100).add(&mut h.rsc);
|
||||
h.set_root((bar, row).span(Dir::RIGHT));
|
||||
@@ -457,8 +457,8 @@ fn a_declared_length_child_is_not_redrawn_when_the_box_around_it_grows() {
|
||||
// drawing the child in its own box is only an answer for that box.
|
||||
let (counter, draws) = counted(&mut h, Size::from((80, 200)), OnResize::Redraw);
|
||||
let fixed = counter.width(80).add(&mut h.rsc);
|
||||
let (rest, _) = counted(&mut h, Size::REST, OnResize::Scale);
|
||||
let row = (fixed, rest).span(Dir::RIGHT).add(&mut h.rsc);
|
||||
let (leftover, _) = counted(&mut h, Size::LEFTOVER, OnResize::Scale);
|
||||
let row = (fixed, leftover).span(Dir::RIGHT).add(&mut h.rsc);
|
||||
let bar = rect(Color::RED).width(100).add(&mut h.rsc);
|
||||
h.set_root((bar, row).span(Dir::RIGHT));
|
||||
let settled = draws.get();
|
||||
|
||||
Reference in new issue
Block a user