max / makeover-layout
1 file changed,
+10 insertions,
-26 deletions
| @@ -121,6 +121,16 @@ | |||
| 121 | 121 | Well, | |
| 122 | 122 | } | |
| 123 | 123 | ||
| 124 | + | // No `fallback` here, deliberately. An earlier cut had `Fill::Well` fall back | |
| 125 | + | // to `Fill::Page` so a consumer on makeover 2.2.0, which has no `surface-well`, | |
| 126 | + | // had something to paint. makeover-tui found that wrong within a day: page is | |
| 127 | + | // the surface a well is usually cut into, so on a terminal that substitution | |
| 128 | + | // produces exactly the invisibility it was meant to prevent, and the right | |
| 129 | + | // answer there is a drawn edge rather than a different colour. | |
| 130 | + | // | |
| 131 | + | // Substituting one intent for another is renderer policy. The description says | |
| 132 | + | // what the region is and stops. | |
| 133 | + | ||
| 124 | 134 | impl Intent for Fill { | |
| 125 | 135 | fn token(self) -> &'static str { | |
| 126 | 136 | match self { | |
| @@ -132,25 +142,6 @@ | |||
| 132 | 142 | } | |
| 133 | 143 | } | |
| 134 | 144 | ||
| 135 | - | impl Fill { | |
| 136 | - | /// What to use where [`Fill::token`] is not available yet. | |
| 137 | - | /// | |
| 138 | - | /// `surface-well` is derived by makeover 2.3.0, which is bumped in-tree | |
| 139 | - | /// and not published, so consumers on 2.2.0 have no such token. A well | |
| 140 | - | /// filled `surface-page` is what audiofiles ships today and is close | |
| 141 | - | /// enough to read as recessed; it is wrong only in that it does not track | |
| 142 | - | /// the raised surface it was cut from. | |
| 143 | - | /// | |
| 144 | - | /// Delete this once 2.3.0 is published and the three consumers adopt it. | |
| 145 | - | #[must_use] | |
| 146 | - | pub const fn fallback(self) -> Option<Self> { | |
| 147 | - | match self { | |
| 148 | - | Self::Well => Some(Self::Page), | |
| 149 | - | _ => None, | |
| 150 | - | } | |
| 151 | - | } | |
| 152 | - | } | |
| 153 | - | ||
| 154 | 145 | /// How a region sits relative to the surface behind it. | |
| 155 | 146 | /// | |
| 156 | 147 | /// Fill and bevel are named together because naming them apart is what let | |
| @@ -262,11 +253,4 @@ | |||
| 262 | 253 | } | |
| 263 | 254 | } | |
| 264 | 255 | ||
| 265 | - | #[test] | |
| 266 | - | fn only_the_well_needs_a_fallback() { | |
| 267 | - | assert_eq!(Fill::Well.fallback(), Some(Fill::Page)); | |
| 268 | - | for f in [Fill::Page, Fill::Raised, Fill::Overlay] { | |
| 269 | - | assert_eq!(f.fallback(), None); | |
| 270 | - | } | |
| 271 | - | } | |
| 272 | 256 | } |