Skip to main content

max / makeover-tui

Fill the bar along the curve, not along the extent makeover-layout 0.32.0. Where a value sits is `Curve::position_of`'s answer now, not its proportion of min..max. Under `Curve::Linear` those are the same number, so every range drawn before this is unchanged; under a constant ratio they are not, and a bar filled linearly would put an envelope's whole useful half inside its first cell. The two ends beside the bar do not move. They are f(0) and f(1), which is what they always were and is now what the description calls them. 68 tests pass, clippy clean, fmt clean.
Author: Max Johnson <me@maxj.phd> · 2026-08-21 17:37 UTC
Signed with PGP, not checked
Commit: 59eb3b81c4097b41dc1474c40ee633c1bdff1be6
Parent: f69f8db
3 files changed, +22 insertions, -6 deletions
M Cargo.toml +2 -2
@@ -1,6 +1,6 @@
1 1 [package]
2 2 name = "makeover-tui"
3 - version = "0.30.0"
3 + version = "0.31.0"
4 4 edition = "2024"
5 5 description = "The terminal renderer for makeover-layout, on ratatui. Colour stops being the constraint above 256 entries; geometry never does, because an edge occupies a whole cell on every side."
6 6 license = "MIT"
@@ -19,7 +19,7 @@
19 19 # compile against an API added in a later one -- which is what `Depth::Overlay`
20 20 # would do here. The rest of the suite has pinned this way since
21 21 # makeover-webview found it the hard way.
22 - makeover-layout = "0.31.0"
22 + makeover-layout = "0.32.0"
23 23 makeover = { version = "3.0", optional = true }
24 24
25 25 [lints.rust]
M src/lib.rs +11
@@ -127,6 +127,17 @@
127 127 //! once, so an unanswered one is a list with no mark against any row rather
128 128 //! than an empty box with nothing in it.
129 129 //!
130 + //! # 0.31.0: the bar fills along the curve
131 + //!
132 + //! `makeover-layout` 0.32.0's [`Curve`](makeover_layout::Curve). Where a value
133 + //! sits on the bar is the curve's answer now, not its proportion of the extent.
134 + //! Under `Curve::Linear` those are the same number, so every range drawn before
135 + //! this is unchanged; under a constant ratio they are not, and a bar filled
136 + //! linearly would put an envelope's whole useful half inside its first cell.
137 + //!
138 + //! The two ends beside the bar do not move: they are `f(0)` and `f(1)`, which
139 + //! is what they always were and is now what the description calls them.
140 + //!
130 141 //! # The correction this renderer forced
131 142 //!
132 143 //! [`makeover_layout::Fill`] briefly carried a `fallback` method, returning
M src/piece.rs +9 -4
@@ -560,14 +560,19 @@
560 560 .and_then(|(min, max)| Some((min.parse::<f64>().ok()?, max.parse::<f64>().ok()?)));
561 561 let filled = match (ends, value.parse::<f64>()) {
562 562 (Some((min, max)), Ok(number)) if max > min => {
563 + // Where the value sits is the curve's answer, not a proportion of
564 + // the extent (makeover-layout 0.32.0). Under `Curve::Linear` the two
565 + // are the same number, which is why the bar was right before and is
566 + // unchanged for every range described so far; under a constant ratio
567 + // they are not, and a bar drawn linearly would put an envelope's
568 + // whole useful half inside its first cell.
563 569 #[expect(
564 570 clippy::cast_possible_truncation,
565 571 clippy::cast_sign_loss,
566 - reason = "the proportion is clamped to 0..=1 before it is scaled by a cell count \
567 - that came from a u16"
572 + reason = "`position_of` returns 0..=1, and the cell count came from a u16"
568 573 )]
569 - let reached = (((number - min) / (max - min)).clamp(0.0, 1.0) * cells as f64) as usize;
570 - reached
574 + let reached = (field.curve.position_of(number, min, max) * cells as f64) as usize;
575 + reached.min(cells)
571 576 }
572 577 _ => 0,
573 578 };