Skip to main content

max / makeover-immediate

Take the well substitution back from the description makeover-layout no longer offers Fill::fallback, because makeover-tui showed that substituting one intent for another is a renderer decision. This renderer still wants it: on a surface that can paint any colour exactly, a page-filled well reads correctly and is what audiofiles has shipped all along. Behaviour is unchanged. The policy just lives where it is true.
Author: Max Johnson <me@maxj.phd> · 2026-07-28 21:31 UTC
Signed with PGP, not checked
Commit: ccb1beb21d3126271ee9bdfd3b15e5369535e37d
Parent: ec7fa89
1 file changed, +11 insertions, -11 deletions
M src/lib.rs +11 -11
@@ -62,23 +62,21 @@
62 62 impl Palette {
63 63 /// Resolve a surface intent.
64 64 ///
65 - /// Honours [`Fill::fallback`], so a consumer whose makeover predates
66 - /// `surface-well` gets a page-filled well rather than a panic or a hole.
67 - /// The description says what the region *is*; supplying the fallback is
68 - /// this renderer's job, not the caller's.
65 + /// `Fill::Well` substitutes the page when the theme has no `surface-well`,
66 + /// which is every theme on makeover before 2.3.0. That substitution lives
67 + /// here rather than in the description because it is only right for a
68 + /// renderer that can always paint an exact colour: makeover-tui had to
69 + /// reject it, since on a terminal the page is often the very surface the
70 + /// well is cut into and the two quantise together.
71 + ///
72 + /// Delete it once 2.3.0 is published and the consumers adopt it.
69 73 #[must_use]
70 74 pub fn fill(&self, fill: Fill) -> Color32 {
71 75 match fill {
72 76 Fill::Page => self.page,
73 77 Fill::Raised => self.raised,
74 78 Fill::Overlay => self.overlay,
75 - Fill::Well => match self.well {
76 - Some(c) => c,
77 - None => match fill.fallback() {
78 - Some(f) => self.fill(f),
79 - None => self.page,
80 - },
81 - },
79 + Fill::Well => self.well.unwrap_or(self.page),
82 80 }
83 81 }
84 82
@@ -193,6 +191,8 @@
193 191
194 192 #[test]
195 193 fn a_well_falls_back_to_the_page_before_makeover_2_3() {
194 + // This renderer's policy, not the description's. See makeover-tui,
195 + // which reaches the opposite conclusion for the same intent.
196 196 let p = palette(None);
197 197 assert_eq!(p.fill(Fill::Well), p.page);
198 198 // and uses the real token once the theme carries one