🔥 remove(app): floating notice plate — the ledger strip is the one notice channel
Browse files at this commitdee569d6a588ca23c038d63163375ee0e6bbb752Parent: ab70ac14 changed files +29 -213
- crates/app/src/notices.rs +7 -8
- crates/app/src/player/actions.rs +0 -7
- crates/app/src/tests/layout.rs +8 -65
- crates/app/src/ui/stance.rs +14 -133
crates/app/src/notices.rsmodified+7 -8
| @@ -55,14 +55,13 @@ pub(crate) fn audio_notice(session: &PlaybackSession) -> Option<String> { | ||
| 55 | 55 | mod tests { |
| 56 | 56 | use super::*; |
| 57 | 57 | |
| 58 | - /// The class this guards: a notice queued behind an earlier, undismissed | |
| 59 | - /// one is never *lost* -- `push_notice` still appends it to the back -- | |
| 60 | - /// but a reader of `front()` alone (what `stance::notice_plate` read | |
| 61 | - /// before this fix) would never see it, because nothing but a keystroke | |
| 62 | - /// ever calls `dismiss_notice`, and most of what fills this queue (a | |
| 63 | - /// click on a gap, a menu row, a drag) is not one. `back()` is the read | |
| 64 | - /// that survives that: it always names the newest message, which is why | |
| 65 | - /// the plate and the ledger's "last action" both read it now. | |
| 58 | + /// The class this guards: a notice queued behind an earlier one is never | |
| 59 | + /// *lost* -- `push_notice` still appends it to the back -- but a reader | |
| 60 | + /// of `front()` alone would never see it, since nothing dismisses the | |
| 61 | + /// queue any more (the floating plate and its keystroke-dismiss went | |
| 62 | + /// with it, user 2026-08-27). `back()` is the read that survives that: | |
| 63 | + /// it always names the newest message, which is why the ledger's "last | |
| 64 | + /// action" -- the one notice channel left -- reads it. | |
| 66 | 65 | /// |
| 67 | 66 | /// This is a value-level check on the queue only -- this binary has no |
| 68 | 67 | /// `TestAppContext`, so it cannot measure what actually painted, and this |
crates/app/src/player/actions.rsmodified+0 -7
| @@ -243,13 +243,6 @@ impl Player { | ||
| 243 | 243 | push_notice(&mut self.notices, message); |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - /// Answers the message on the bar and brings up the next one. Whether there | |
| 247 | - /// was one to answer, because a key that dismissed a notice owes a repaint | |
| 248 | - /// and a key that dismissed nothing does not. | |
| 249 | - pub(crate) fn dismiss_notice(&mut self) -> bool { | |
| 250 | - self.notices.pop_front().is_some() | |
| 251 | - } | |
| 252 | - | |
| 253 | 246 | /// The magnet off and on again, in words: a snap that stops working |
| 254 | 247 | /// silently reads as a bug, and one that starts working silently reads as |
| 255 | 248 | /// one too. The line goes with it -- nothing is being promised any more. |
crates/app/src/tests/layout.rsmodified+8 -65
| @@ -1914,61 +1914,6 @@ fn a_lane_row_fits_what_its_own_head_draws() { | ||
| 1914 | 1914 | ); |
| 1915 | 1915 | } |
| 1916 | 1916 | |
| 1917 | -/// The notice plate's own anchor ([`crate::ui::stance::notice_bottom_offset`]) | |
| 1918 | -/// sits a fixed step above the ledger, not floated by `bench_h` -- a float | |
| 1919 | -/// used to put the plate up beside the time band's transport timecode row | |
| 1920 | -/// for a tall bench, reading as if it belonged to that row instead of the | |
| 1921 | -/// ledger it answers (user report). `Player`'s live tree has no | |
| 1922 | -/// `TestAppContext` in this binary to mount a real `notice_plate` in and | |
| 1923 | -/// read its painted bounds back, so this checks the pure geometry the | |
| 1924 | -/// anchor is built from, and the source-level anchor that now keeps the | |
| 1925 | -/// plate off the bench's left-aligned V1/A1 lane chips horizontally instead | |
| 1926 | -/// (right-aligned, DESIGN §11.6) rather than by floating with `bench_h`. | |
| 1927 | -#[test] | |
| 1928 | -fn the_notice_plate_sits_a_fixed_step_above_the_ledger_right_aligned() { | |
| 1929 | - use crate::ui::stance::{LEDGER_H, notice_bottom_offset}; | |
| 1930 | - | |
| 1931 | - assert_eq!( | |
| 1932 | - notice_bottom_offset(), | |
| 1933 | - LEDGER_H + 6., | |
| 1934 | - "the notice plate's bottom offset drifted off the ledger -- it must \ | |
| 1935 | - stay a fixed step above it, not float with bench_h again" | |
| 1936 | - ); | |
| 1937 | - | |
| 1938 | - let body = fn_body("notice_plate"); | |
| 1939 | - assert!( | |
| 1940 | - body.contains(".right(px(12.))") && !body.contains(".left(px(12.))"), | |
| 1941 | - "notice_plate must anchor right, clear of the bench's left-aligned \ | |
| 1942 | - V1/A1 lane chips (DESIGN §11.6)" | |
| 1943 | - ); | |
| 1944 | -} | |
| 1945 | -/// The renderer only wraps text when the text measurement receives a definite | |
| 1946 | -/// width and normal whitespace. This source-level guard keeps both declarations | |
| 1947 | -/// on the notice plate: `max_w` alone limits max-content after that measurement | |
| 1948 | -/// and silently permits one-line overflow. It cannot inspect GPUI's painted | |
| 1949 | -/// lines; only live driving can confirm the full notice actually wrapped. | |
| 1950 | -#[test] | |
| 1951 | -fn the_notice_plate_declares_a_bounded_wrapping_text_layout() { | |
| 1952 | - let stance = src_text("ui/stance.rs"); | |
| 1953 | - let notice_start = stance | |
| 1954 | - .find("fn notice_plate(") | |
| 1955 | - .expect("notice plate moved or renamed"); | |
| 1956 | - let notice_end = stance[notice_start..] | |
| 1957 | - .find("\n/// Thin strip") | |
| 1958 | - .map(|end| notice_start + end) | |
| 1959 | - .expect("notice plate no longer precedes the ledger"); | |
| 1960 | - let plate = &stance[notice_start..notice_end]; | |
| 1961 | - | |
| 1962 | - assert!( | |
| 1963 | - plate.contains(".w_full()") && plate.contains(".max_w(px(480.))"), | |
| 1964 | - "notice plate lacks a definite width bounded to 480 px; max_w alone does not wrap text" | |
| 1965 | - ); | |
| 1966 | - assert!( | |
| 1967 | - plate.contains(".whitespace_normal()"), | |
| 1968 | - "notice plate no longer explicitly requests GPUI's wrapping whitespace mode" | |
| 1969 | - ); | |
| 1970 | -} | |
| 1971 | - | |
| 1972 | 1917 | /// A round trip through the file: what is saved is what the next load reads |
| 1973 | 1918 | /// back, all five seams touched -- a scratch path, not the real config, the |
| 1974 | 1919 | /// same isolation `keymap::tests`' own `load_from`/`save_to` already takes. |
| @@ -2195,18 +2140,16 @@ fn the_picture_letterboxes_through_a_canvas_never_a_plain_img_object_fit() { | ||
| 2195 | 2140 | /// [`Player::picture_area`](crate::Player::picture_area) directly, so a |
| 2196 | 2141 | /// notice surface that reaches into that method unconditionally reaches the |
| 2197 | 2142 | /// picture on the darkroom path too -- measured live covering the bottom 10% |
| 2198 | -/// of the frame (rows 300-333 of 335) *underneath* the stance's own | |
| 2199 | -/// §8-conformant plate (`ui::stance::notice_plate`), which drew the same | |
| 2200 | -/// notice a second time above the ledger. The legacy full-width `notice_bar` | |
| 2201 | -/// and its non-darkroom caller are gone with the rest of the old tree now, | |
| 2202 | -/// so this pins the sole remaining channel (`notice_plate`) off the | |
| 2203 | -/// picture for good. | |
| 2143 | +/// of the frame (rows 300-333 of 335). The legacy full-width `notice_bar` | |
| 2144 | +/// and its non-darkroom caller are gone with the rest of the old tree, and | |
| 2145 | +/// the floating notice plate went after them (user 2026-08-27: the ledger's | |
| 2146 | +/// own "last action" strip is the one notice channel now), so this pins | |
| 2147 | +/// `picture_area` itself never growing a notice surface back. | |
| 2204 | 2148 | #[test] |
| 2205 | 2149 | fn the_darkroom_path_never_lets_a_notice_surface_reach_the_picture() { |
| 2206 | - // `notice_bar` and its legacy (non-darkroom) caller are gone with the | |
| 2207 | - // rest of the old tree -- the darkroom's own `ui::stance::notice_plate` | |
| 2208 | - // is the only notice channel left, and the stronger invariant now is | |
| 2209 | - // that picture_area's body never draws a second one over the picture. | |
| 2150 | + // The ledger strip (`ui::stance::ledger` reading `notices.back()`) is | |
| 2151 | + // the only notice channel left, and the invariant is that | |
| 2152 | + // picture_area's body never draws one over the picture. | |
| 2210 | 2153 | let body = fn_body("picture_area"); |
| 2211 | 2154 | assert!( |
| 2212 | 2155 | !body.contains("notice_bar"), |
crates/app/src/ui/stance.rsmodified+14 -133
| @@ -453,8 +453,8 @@ fn keys_overlay(player: &Player, bench_h: f32, cx: &mut Context<Player>) -> impl | ||
| 453 | 453 | .bottom_0() |
| 454 | 454 | .left_0() |
| 455 | 455 | .right_0() |
| 456 | - // The live `bench_h` the caller already measures for `bench`/ | |
| 457 | - // `notice_plate`, not the fixed `BENCH_H` default: a hand-dragged | |
| 456 | + // The live `bench_h` the caller already measures for `bench`, | |
| 457 | + // not the fixed `BENCH_H` default: a hand-dragged | |
| 458 | 458 | // bench taller than the default left this scrim short of the real |
| 459 | 459 | // footprint, so the overlay stopped mid-bench instead of covering it. |
| 460 | 460 | .h(px(bench_h + LEDGER_H)) |
| @@ -724,126 +724,6 @@ fn bench( | ||
| 724 | 724 | .child(bench_stance::render(player, bench_h - BENCH_CHROME_H, cx)) |
| 725 | 725 | } |
| 726 | 726 | |
| 727 | -/// Which of the three §8 severities a notice's own words carry. Reuses | |
| 728 | -/// [`notice_tone`] (the legacy bar's own classification, by word) rather than | |
| 729 | -/// a second heuristic, and folds its four-way answer onto the darkroom's | |
| 730 | -/// three tokens: `STATUS_ERROR`/`STATUS_WARNING` are the same constants as | |
| 731 | -/// `NOTICE_DECIDE`/`NOTICE_LOOK` already (`ui/theme.rs`'s `darkroom` module | |
| 732 | -/// aliases them both ways), so the two failure/refusal tones fold straight | |
| 733 | -/// across and everything else -- success included -- reads as *told you*. | |
| 734 | -fn notice_severity(message: &str) -> u32 { | |
| 735 | - let tone = notice_tone(message); | |
| 736 | - if tone == STATUS_ERROR() { | |
| 737 | - NOTICE_DECIDE() | |
| 738 | - } else if tone == STATUS_WARNING() { | |
| 739 | - NOTICE_LOOK() | |
| 740 | - } else { | |
| 741 | - NOTICE_TELL() | |
| 742 | - } | |
| 743 | -} | |
| 744 | - | |
| 745 | -/// [`notice_plate`]'s own `bottom` offset, pulled out as a pure function so | |
| 746 | -/// a `TestAppContext`-less test binary (this crate's own, no live `Context` | |
| 747 | -/// to mount a real `notice_plate` in) can still check the anchor without | |
| 748 | -/// duplicating the arithmetic by hand and risking the two drifting apart. | |
| 749 | -/// | |
| 750 | -/// Anchored a fixed `LEDGER_H + 6.` above the ledger, not floated by | |
| 751 | -/// `bench_h` (F3, user report): floating it `bench_h` further up put the | |
| 752 | -/// plate up beside the time band's transport timecode row for any tall | |
| 753 | -/// bench, reading as if it belonged to that row instead of the ledger it | |
| 754 | -/// answers. The old float existed only to dodge the bench's V1/A1 lane | |
| 755 | -/// chips (F2) -- [`notice_plate`] now dodges those horizontally instead | |
| 756 | -/// (right-aligned, DESIGN §11.6: the lane chips there are left-aligned), | |
| 757 | -/// so the vertical float is no longer needed to keep the plate clear. | |
| 758 | -pub(crate) fn notice_bottom_offset() -> f32 { | |
| 759 | - LEDGER_H + 6. | |
| 760 | -} | |
| 761 | - | |
| 762 | -/// A notice plate (DESIGN §8): one at a time, rising above the *bench*, its | |
| 763 | -/// severity a 3px left spine rather than a colour flood. Fed by the same | |
| 764 | -/// [`Player::notify_user`]/`notices` queue the legacy bar reads | |
| 765 | -/// ([`Player::notice_bar`]) -- no second notice channel. | |
| 766 | -/// | |
| 767 | -/// Reads the *back* of the queue, not the front: dismissal only ever fires | |
| 768 | -/// on a keystroke ([`render`]'s `on_key_down` calling `dismiss_notice()`), | |
| 769 | -/// and most of what fills this queue -- a click on a gap, a menu row, a | |
| 770 | -/// drag -- is not one. A `front()` plate left showing a `ctrl+s` "SAVED" | |
| 771 | -/// notice sat frozen through an unrelated mouse-driven refusal that queued | |
| 772 | -/// in behind it: the ledger strip's own "last action" already reads | |
| 773 | -/// `back()` for exactly this reason, and the plate disagreeing with it is | |
| 774 | -/// what made the refusal look like it never reached the notice surface at | |
| 775 | -/// all. `back()` keeps the two in step and guarantees the newest, most | |
| 776 | -/// actionable message is always the one on screen. | |
| 777 | -/// | |
| 778 | -/// Anchored a fixed [`notice_bottom_offset`] above the ledger, bottom-right | |
| 779 | -/// (DESIGN §5's timecode/transport row lives bottom-left of the time band, | |
| 780 | -/// well above this): a `bench_h`-floated offset used to put the plate right | |
| 781 | -/// beside that transport row for a tall bench, reading as if it belonged to | |
| 782 | -/// the wrong strip (user report). Right-aligned rather than left keeps it | |
| 783 | -/// off the bench's own V1/A1 lane chips, which are left-aligned there | |
| 784 | -/// (DESIGN §11.6 occlusion check) -- horizontal separation now does the job | |
| 785 | -/// the old vertical float existed for. | |
| 786 | -/// | |
| 787 | -/// corner-cut: amber's "carries a jump action" is not wired -- the queue | |
| 788 | -/// only ever held plain text, no structured jump target, in either the | |
| 789 | -/// legacy bar or here. Ceiling: give `notify_user` an optional jump payload | |
| 790 | -/// once a call site actually has one to carry. | |
| 791 | -fn notice_plate(message: SharedString, cx: &mut Context<Player>) -> impl IntoElement { | |
| 792 | - div() | |
| 793 | - .id("stance-notice") | |
| 794 | - .absolute() | |
| 795 | - .bottom(px(notice_bottom_offset())) | |
| 796 | - .right(px(12.)) | |
| 797 | - .cursor_pointer() | |
| 798 | - // A click answers the notice the same way any other key does | |
| 799 | - // (`stance-room`'s `on_key_down` -> `Player::dismiss_notice`): | |
| 800 | - // the darkroom's own click-to-dismiss for a plate with no other | |
| 801 | - // affordance on it (DESIGN §8). | |
| 802 | - .on_mouse_down( | |
| 803 | - MouseButton::Left, | |
| 804 | - cx.listener(|this, _: &MouseDownEvent, _, cx| { | |
| 805 | - if this.dismiss_notice() { | |
| 806 | - cx.notify(); | |
| 807 | - } | |
| 808 | - }), | |
| 809 | - ) | |
| 810 | - // `max_w` only caps a box after GPUI has measured its text at | |
| 811 | - // max-content width. `w_full` supplies a definite width to that | |
| 812 | - // measurement (then `max_w` bounds it at 480 px), and normal | |
| 813 | - // whitespace gives the text system permission to shape every word | |
| 814 | - // into the resulting lines. Keep this a block: as a flex child the | |
| 815 | - // text's automatic min-content width can overflow its own plate. | |
| 816 | - // | |
| 817 | - // No fixed height: GPUI's shaped lines contribute their actual | |
| 818 | - // default `phi()` line boxes, so two or three lines grow upward from | |
| 819 | - // this bottom anchor without reaching down over the bench lanes. | |
| 820 | - .w_full() | |
| 821 | - .max_w(px(480.)) | |
| 822 | - .whitespace_normal() | |
| 823 | - .px(px(10.)) | |
| 824 | - .py(px(6.)) | |
| 825 | - .rounded(px(2.)) | |
| 826 | - .bg(rgb(DARK_PANEL())) | |
| 827 | - // The severity spine (DESIGN §8): a 3px left border, coloured, same | |
| 828 | - // shape as the legacy notice bar's own tone stripe (`notice_bar`). | |
| 829 | - .border_l(px(3.)) | |
| 830 | - .border_color(rgb(notice_severity(&message))) | |
| 831 | - .type_style(type_scale::label( | |
| 832 | - type_scale::LABEL_ROW_PX, | |
| 833 | - gpui::FontWeight::MEDIUM, | |
| 834 | - )) | |
| 835 | - .text_color(rgb(INK1())) | |
| 836 | - // `div()` is a flex row by default, and a bare text child measures | |
| 837 | - // its min-content as the *whole line* (`TextLayout::layout` only | |
| 838 | - // wraps against a `Definite` available width, which a flex item's | |
| 839 | - // content-sizing pass never supplies). `w_full`/`max_w` on the | |
| 840 | - // plate itself only bounds the *container* -- the text still never | |
| 841 | - // sees a definite width to wrap against unless it is a `flex_1` | |
| 842 | - // child, which is handed the container's resolved width. Same fix | |
| 843 | - // as `overlays.rs`'s notice bar (`div().flex_1().min_w(...)`). | |
| 844 | - .child(div().flex_1().child(message)) | |
| 845 | -} | |
| 846 | - | |
| 847 | 727 | /// Thin strip at the bottom of the centre column: project identity, last |
| 848 | 728 | /// action, export progress, position. Notices rise from here (DESIGN §5, §8). |
| 849 | 729 | fn ledger(player: &Player, position: f64) -> impl IntoElement { |
| @@ -860,6 +740,17 @@ fn ledger(player: &Player, position: f64) -> impl IntoElement { | ||
| 860 | 740 | } |
| 861 | 741 | ); |
| 862 | 742 | let last_action = player.notices.back().cloned().unwrap_or_else(|| "—".into()); |
| 743 | + // With the floating plate gone (user 2026-08-27, "we also have notifier | |
| 744 | + // at the ledger section"), this strip is the one notice surface left -- | |
| 745 | + // a refusal or a failure keeps the tone the plate's severity spine | |
| 746 | + // carried ([`notice_tone`], the same word-read the legacy bar used), | |
| 747 | + // while everything routine stays at the strip's own quiet ink. | |
| 748 | + let tone = notice_tone(&last_action); | |
| 749 | + let action_ink = if tone == STATUS_ERROR() || tone == STATUS_WARNING() { | |
| 750 | + tone | |
| 751 | + } else { | |
| 752 | + INK3() | |
| 753 | + }; | |
| 863 | 754 | let export = player |
| 864 | 755 | .exporting() |
| 865 | 756 | .map(|h| format!("EXPORTING {:.0}%", h.progress() * 100.)); |
| @@ -897,7 +788,7 @@ fn ledger(player: &Player, position: f64) -> impl IntoElement { | ||
| 897 | 788 | type_scale::CHORD_METADATA_MIN_PX, |
| 898 | 789 | gpui::FontWeight::MEDIUM, |
| 899 | 790 | )) |
| 900 | - .text_color(rgb(INK3())) | |
| 791 | + .text_color(rgb(action_ink)) | |
| 901 | 792 | .child(last_action), |
| 902 | 793 | ) |
| 903 | 794 | .children(export.map(|e| { |
| @@ -1012,9 +903,6 @@ pub(crate) fn render( | ||
| 1012 | 903 | Player::discard_sidecar(&sidecar); |
| 1013 | 904 | } |
| 1014 | 905 | } |
| 1015 | - if this.dismiss_notice() { | |
| 1016 | - cx.notify(); | |
| 1017 | - } | |
| 1018 | 906 | // DESIGN §9: "`?` held ... surfaces chords ... release restores. |
| 1019 | 907 | // No modal cheat-sheet." Opened here, ahead of the modal guard |
| 1020 | 908 | // below (which would otherwise swallow a second `?` down once |
| @@ -1245,13 +1133,6 @@ pub(crate) fn render( | ||
| 1245 | 1133 | .children(player.silence_card(window_size, cx)) |
| 1246 | 1134 | .children(player.mix_card(window_size, cx)) |
| 1247 | 1135 | .children(player.subtitle_style_card(window_size, cx)) |
| 1248 | - }) | |
| 1249 | - // Mounted after `card_maximized` (not beside `ledger` above | |
| 1250 | - // any more): a maximized Mix/EQ card painted over a notice | |
| 1251 | - // sitting below it in this same child list, and a notice is | |
| 1252 | - // transient -- it should win over a card, not lose to one. | |
| 1253 | - .when_some(player.notices.back().cloned(), |el, n| { | |
| 1254 | - el.child(notice_plate(n, cx)) | |
| 1255 | 1136 | }), |
| 1256 | 1137 | ) |
| 1257 | 1138 | .child(divider(Split::Dock, cx)) |