fix: reserve empty MIDI feedback space

Keep the horizontal fader meter height stable by always reserving its pickup-status row at normal strip heights. Unassigned and hidden indicators render that row empty instead of expanding the meter.

Tests: cargo fmt --all -- --check; cargo check --workspace --all-targets --all-features; cargo test -p tui; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo test --workspace --doc --all-features; cargo build --workspace --release --all-features. Full workspace tests stop at the pre-existing edited examples/profiles/arch-pipewire.toml fixture mismatch.
This commit is contained in:
Dandaedre 2026-10-18 12:51:25 +02:00
parent 34c738847f
commit d12dfb8f27
Signed by: Dandaedre
GPG Key ID: 440C6592E8A26D99
3 changed files with 44 additions and 6 deletions

View File

@ -486,7 +486,8 @@ The persisted modes are `detailed` (`pickup: tracking`), `compact` (`LIVE`),
`symbol` (a state-specific Unicode glyph), `color` (one fixed glyph using the
semantic status color), and `hidden` (no pickup indicator). Detailed is the
backward-compatible default. Both mixer orientations use the same mapping;
horizontal mode reclaims the pickup footer row when the indicator is hidden.
horizontal mode reserves the pickup footer row even when the indicator is
hidden or the fader has no MIDI assignment, keeping every meter the same height.
The TUI is mixer-first rather than exposing the profile's normalized tables as
separate tabs. Its main list is an ordered presentation of logical faders and

View File

@ -409,6 +409,8 @@ Dependencies: M8, M2, M1.
Config also persists pickup-status presentation as Detailed, Compact,
Symbol, Color, or Hidden. Both mixer orientations share the same state
mapping, and hiding the indicator does not disable pickup protection.
Horizontal strips reserve an empty pickup-status row for unassigned or hidden
indicators so MIDI assignment never changes the meter height.
Reordering saved layouts now resets TOML source-order metadata: parsed table
positions previously undid accepted moves during serialization, causing the
optimistic TUI swap to snap back. Regression tests cover repeated file reloads,

View File

@ -4896,11 +4896,7 @@ impl<C: MixerClient> LiveTui<C> {
self.snapshot.configuration.status_display,
theme,
);
let footer_height = if area.height >= 9 && !pickup.text.is_empty() {
4
} else {
3
};
let footer_height = if area.height >= 9 { 4 } else { 3 };
let meter_height = area.height.saturating_sub(footer_height);
let meter_width = area.width.saturating_sub(4).clamp(3, 7);
let meter_area = Rect::new(
@ -6210,6 +6206,10 @@ mod tests {
fn pickup_status_display_modes_use_distinct_feedback() {
let theme = ThemeName::Default.palette();
assert_eq!(
pickup_display(None, StatusDisplayMode::Detailed, theme).text,
""
);
assert_eq!(
pickup_display(
Some(PickupStatus::Tracking),
@ -6257,6 +6257,41 @@ mod tests {
);
}
#[test]
fn horizontal_faders_reserve_an_empty_pickup_status_row_when_unassigned() {
let app = LiveTui::new(DemoClient::default()).unwrap();
let mut assigned = app.snapshot.items[0].clone();
assigned.pickup = Some(PickupStatus::Waiting);
let mut unassigned = assigned.clone();
unassigned.pickup = None;
let area = Rect::new(0, 0, 16, 12);
let render_meter_bottom = |item: &MixerItem| {
let mut buffer = Buffer::empty(area);
app.render_fader_strip(
area,
&mut buffer,
&MixerRow::Fader {
layout_id: None,
item,
density: FaderDensity::Standard,
},
false,
);
buffer
.content
.iter()
.position(|cell| cell.symbol() == "└")
.map(|index| index / usize::from(area.width))
.unwrap()
};
assert_eq!(
render_meter_bottom(&assigned),
render_meter_bottom(&unassigned)
);
}
#[test]
fn mixer_layout_reorders_and_hides_while_settings_restores_faders() {
let mut snapshot = DemoClient::default().view();