fix(tui): use the footer's own words in the settings preview

The footer preview at the bottom of /settings draws with the real
footer renderer, but it passed the raw setting values in as chip text.
With Startup mode set to Work the preview read "● ask   agent" while
the footer under the composer reads "● ask   work", and with Plan it
read "● ask   plan" where the footer reads "● read only   plan".

Parse the two rows into AppMode and ApprovalMode and take the words and
inks from the helpers the footer itself uses (mode_label,
permission_label_for, header_mode_ink, header_permission_ink). The
preview now also follows the UI language like the footer does.

The 80x24 and 120x32 Settings goldens pinned "● ask   agent" on the
preview line; they now read "● ask   work".

Signed-off-by: Lstarsky0 <[email protected]>
This commit is contained in:
Lstarsky0 committed 2026-10-16 12:07:37 +08:00
1 parent b5e270b690
commit 543f79fa9e
4 files changed
+21 -20

No files matched your search

@@ -26,7 +26,7 @@
│ │
│ │
system | terminal | shoreline | shoreline-light | underwater | underwater-retro | dark | light | grayscale |…
Preview: ● ask agent
Preview: ● ask work
type=filter, Up/Down=select, Enter=edit, Esc=close
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
@@ -18,7 +18,7 @@
system | terminal | shoreline | shoreline-light | underwater |…
Enter or click again: Enter opens choices · Theme: current terminal · saved
terminal · applies on save
Preview: ● ask agent
Preview: ● ask work
type=filter, Up/Down=select, Enter=edit, PgUp/PgDn=scroll, Esc=close
──────────────────────────────────────────────────────────────────────────────
+3 -3
View File
@@ -687,7 +687,7 @@ impl ShellPhase {
/// Exhaustive on purpose: a new [`AppMode`] must be handed a Policy ink
/// deliberately rather than inheriting act's by falling through a wildcard.
fn header_mode_ink(mode: AppMode) -> ChromeInk {
pub(crate) fn header_mode_ink(mode: AppMode) -> ChromeInk {
match mode {
AppMode::Plan => ChromeInk::PolicyPlan,
AppMode::Operate => ChromeInk::PolicyOperate,
@@ -695,7 +695,7 @@ fn header_mode_ink(mode: AppMode) -> ChromeInk {
}
}
fn header_permission_ink(mode: ApprovalMode) -> ChromeInk {
pub(crate) fn header_permission_ink(mode: ApprovalMode) -> ChromeInk {
match mode {
ApprovalMode::Suggest | ApprovalMode::Never => ChromeInk::PermissionAsk,
ApprovalMode::Auto => ChromeInk::PermissionAutoReview,
@@ -900,7 +900,7 @@ pub(crate) fn phase_marker_with_activity(
}
}
fn mode_label(locale: Locale, mode: AppMode) -> Cow<'static, str> {
pub(crate) fn mode_label(locale: Locale, mode: AppMode) -> Cow<'static, str> {
match mode {
AppMode::Agent => tr(locale, MessageId::ChipModeAct),
AppMode::Plan => tr(locale, MessageId::ChipModePlan),
+16 -15
View File
@@ -5300,25 +5300,26 @@ impl ConfigView {
let context_percent = self.snapshot.context_budget.as_ref().map_or(0, |budget| {
u8::try_from(budget.percent_basis_points / 100).unwrap_or(100)
});
let mode = value_of("default_mode").unwrap_or_else(|| "agent".to_string());
let mode_ink = match mode.as_str() {
"plan" => palette::ChromeInk::PolicyPlan,
"operate" => palette::ChromeInk::PolicyOperate,
_ => palette::ChromeInk::PolicyAct,
};
let permission = value_of("approval_mode")
let mode = value_of("default_mode").map_or(codewhale_config::AppMode::Agent, |value| {
codewhale_config::AppMode::from_setting(&value)
});
let approval = value_of("approval_mode")
.or_else(|| value_of("permission_posture"))
.unwrap_or_else(|| "ask".to_string());
let permission_ink = match permission.as_str() {
"auto-review" => palette::ChromeInk::PermissionAutoReview,
"full-access" => palette::ChromeInk::PermissionFullAccess,
_ => palette::ChromeInk::PermissionAsk,
};
.and_then(|value| codewhale_execpolicy::ApprovalMode::from_config_value(&value))
.unwrap_or(codewhale_execpolicy::ApprovalMode::Suggest);
let mode_label = crate::tui::underwater::mode_label(self.locale, mode);
let permission = crate::core::authority::permission_label_for(self.locale, mode, approval);
let footer = crate::tui::phase_strip::TidelineFooter::new(
&theme,
(permission.as_str(), permission_ink),
(
permission.as_ref(),
crate::tui::underwater::header_permission_ink(approval),
),
)
.mode_chip(Some((mode.as_str(), mode_ink)))
.mode_chip(Some((
mode_label.as_ref(),
crate::tui::underwater::header_mode_ink(mode),
)))
.context_percent(context_percent);
crate::tui::phase_strip::render_tideline_footer(
Rect {