mirror of
https://github.com/l0ng-ai/tty7.git
synced 2026-11-06 08:15:35 +00:00
fix(settings): action menus don't reserve a column for a tick
Every settings menu kept an empty tick column, so a menu of actions (an agent's Reinstall / Reveal / Uninstall) set its labels 24px in from a 12px right edge. The column is kept only when some entry is ticked - a choice menu - and an action menu is padded evenly.
This commit is contained in:
+3
-1
@@ -513,7 +513,9 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::SettingsOn => "オン",
|
||||
L10nKey::SettingsOff => "オフ",
|
||||
L10nKey::SettingsShell => "シェル",
|
||||
L10nKey::SettingsShellIntro => "新しいターミナルで起動するプログラム。空欄なら{default}を使います。",
|
||||
L10nKey::SettingsShellIntro => {
|
||||
"新しいターミナルで起動するプログラム。空欄なら{default}を使います。"
|
||||
}
|
||||
L10nKey::SettingsProgram => "シェルプログラム",
|
||||
L10nKey::SettingsProgramDesc => "PATH 上の名前か絶対パス。例: zsh、fish",
|
||||
L10nKey::SettingsArguments => "シェル引数",
|
||||
|
||||
@@ -158,6 +158,12 @@ impl Tty7App {
|
||||
) -> Div {
|
||||
let tk = Tk::of(cx);
|
||||
let mut panel = kit::menu_panel(&tk);
|
||||
// A choice menu keeps a column for its tick so the labels line up
|
||||
// whichever one is picked. A menu of actions ticks nothing, and the
|
||||
// same empty column left its labels 24px in from a 12px right edge.
|
||||
let ticks = entries
|
||||
.iter()
|
||||
.any(|e| matches!(e, MenuEntry::Item { checked: true, .. }));
|
||||
for (i, entry) in entries.into_iter().enumerate() {
|
||||
panel = match entry {
|
||||
MenuEntry::Item {
|
||||
@@ -173,7 +179,8 @@ impl Tty7App {
|
||||
false,
|
||||
&tk,
|
||||
)
|
||||
.child(kit::check_mark(checked, &tk))
|
||||
.when(ticks, |r| r.child(kit::check_mark(checked, &tk)))
|
||||
.when(!ticks, |r| r.pl(px(12.)))
|
||||
.child(
|
||||
div()
|
||||
.flex_1()
|
||||
|
||||
Reference in New Issue
Block a user