Added search in settings
This commit is contained in:
1 parent
438f202dfe
commit
f6a2f65cd4
1 file changed
+297
-140
+297
-140
@@ -1972,6 +1972,7 @@ struct Moorly {
|
||||
saved_shortcuts: Shortcuts,
|
||||
shortcut_capture: Option<ShortcutCapture>,
|
||||
settings_section: SettingsSection,
|
||||
settings_search: String,
|
||||
pending_settings_section: Option<SettingsSection>,
|
||||
show_start_tab: bool,
|
||||
show_start_tab_draft: bool,
|
||||
@@ -5204,6 +5205,7 @@ impl Default for Moorly {
|
||||
saved_shortcuts: shortcuts,
|
||||
shortcut_capture: None,
|
||||
settings_section: SettingsSection::default(),
|
||||
settings_search: String::new(),
|
||||
pending_settings_section: None,
|
||||
show_start_tab,
|
||||
show_start_tab_draft: show_start_tab,
|
||||
@@ -5337,6 +5339,7 @@ enum Message {
|
||||
SelectTab(window::Id, Tab),
|
||||
CloseTab(window::Id, Tab),
|
||||
SelectSettingsSection(SettingsSection),
|
||||
SettingsSearchChanged(String),
|
||||
SetShowStartTab(bool),
|
||||
AutostartChoiceSelected(AutostartChoice),
|
||||
SelectAutostart(usize),
|
||||
@@ -6222,9 +6225,9 @@ fn update(state: &mut Moorly, message: Message) -> Task<Message> {
|
||||
close_window_if_empty(state, window),
|
||||
]);
|
||||
}
|
||||
Message::SettingsSearchChanged(value) => state.settings_search = value,
|
||||
Message::SelectSettingsSection(section) => {
|
||||
state.folder_menu = None;
|
||||
|
||||
if section == SettingsSection::General {
|
||||
state.autostart_at_login = autostart::enabled();
|
||||
}
|
||||
@@ -8963,63 +8966,23 @@ fn color_swatch_row<'a>(
|
||||
fn shortcuts_panel(state: &Moorly) -> Element<'_, Message> {
|
||||
let mut panel = column![
|
||||
text("Press ... to change a shortcut.").size(12),
|
||||
shortcut_row(
|
||||
&state.typography.h3,
|
||||
ShortcutAction::Settings,
|
||||
state.shortcuts.get(ShortcutAction::Settings),
|
||||
),
|
||||
shortcut_row(
|
||||
&state.typography.h3,
|
||||
ShortcutAction::Quit,
|
||||
state.shortcuts.get(ShortcutAction::Quit)
|
||||
),
|
||||
shortcut_setting(state, ShortcutAction::Settings),
|
||||
shortcut_setting(state, ShortcutAction::Quit),
|
||||
]
|
||||
.spacing(8);
|
||||
|
||||
if hotkeys::backend() == hotkeys::Backend::Native {
|
||||
panel = panel.push(shortcut_row(
|
||||
&state.typography.h3,
|
||||
ShortcutAction::ToggleWindow,
|
||||
state.shortcuts.get(ShortcutAction::ToggleWindow),
|
||||
));
|
||||
panel = panel.push(shortcut_setting(state, ShortcutAction::ToggleWindow));
|
||||
}
|
||||
|
||||
panel = panel
|
||||
.push(shortcut_row(
|
||||
&state.typography.h3,
|
||||
ShortcutAction::CommandPalette,
|
||||
state.shortcuts.get(ShortcutAction::CommandPalette),
|
||||
))
|
||||
.push(shortcut_row(
|
||||
&state.typography.h3,
|
||||
ShortcutAction::QuickTerminal,
|
||||
state.shortcuts.get(ShortcutAction::QuickTerminal),
|
||||
))
|
||||
.push(shortcut_row(
|
||||
&state.typography.h3,
|
||||
ShortcutAction::QuickSsh,
|
||||
state.shortcuts.get(ShortcutAction::QuickSsh),
|
||||
))
|
||||
.push(shortcut_row(
|
||||
&state.typography.h3,
|
||||
ShortcutAction::CloseTab,
|
||||
state.shortcuts.get(ShortcutAction::CloseTab),
|
||||
))
|
||||
.push(shortcut_row(
|
||||
&state.typography.h3,
|
||||
ShortcutAction::MinimizeAll,
|
||||
state.shortcuts.get(ShortcutAction::MinimizeAll),
|
||||
))
|
||||
.push(shortcut_row(
|
||||
&state.typography.h3,
|
||||
ShortcutAction::TerminalCopy,
|
||||
state.shortcuts.get(ShortcutAction::TerminalCopy),
|
||||
))
|
||||
.push(shortcut_row(
|
||||
&state.typography.h3,
|
||||
ShortcutAction::TerminalPaste,
|
||||
state.shortcuts.get(ShortcutAction::TerminalPaste),
|
||||
));
|
||||
.push(shortcut_setting(state, ShortcutAction::CommandPalette))
|
||||
.push(shortcut_setting(state, ShortcutAction::QuickTerminal))
|
||||
.push(shortcut_setting(state, ShortcutAction::QuickSsh))
|
||||
.push(shortcut_setting(state, ShortcutAction::CloseTab))
|
||||
.push(shortcut_setting(state, ShortcutAction::MinimizeAll))
|
||||
.push(shortcut_setting(state, ShortcutAction::TerminalCopy))
|
||||
.push(shortcut_setting(state, ShortcutAction::TerminalPaste));
|
||||
|
||||
if hotkeys::backend() == hotkeys::Backend::Portal {
|
||||
panel = panel.push(
|
||||
@@ -9063,6 +9026,15 @@ fn shortcut_row(
|
||||
.into()
|
||||
}
|
||||
|
||||
/// One shortcut option, dimmed when it does not match the settings search.
|
||||
fn shortcut_setting(state: &Moorly, action: ShortcutAction) -> Element<'_, Message> {
|
||||
dim_setting(
|
||||
state,
|
||||
action.label(),
|
||||
shortcut_row(&state.typography.h3, action, state.shortcuts.get(action)),
|
||||
)
|
||||
}
|
||||
|
||||
/// Popover shown while a new shortcut is being recorded.
|
||||
fn shortcut_capture_panel(capture: &ShortcutCapture) -> Element<'_, Message> {
|
||||
let preview = capture
|
||||
@@ -10466,13 +10438,17 @@ fn start_page(state: &Moorly, window: window::Id) -> Element<'_, Message> {
|
||||
/// Reference table of every command the command palette can offer.
|
||||
fn command_palette_panel(state: &Moorly) -> Element<'_, Message> {
|
||||
let mut rows = column![
|
||||
row![
|
||||
styled_text(&state.typography.h3, "Enable command palette"),
|
||||
space::horizontal(),
|
||||
toggler(state.command_palette_enabled_draft)
|
||||
.on_toggle(Message::SetCommandPaletteEnabled),
|
||||
]
|
||||
.align_y(Alignment::Center),
|
||||
dim_setting(
|
||||
state,
|
||||
"Enable command palette command palette",
|
||||
row![
|
||||
styled_text(&state.typography.h3, "Enable command palette"),
|
||||
space::horizontal(),
|
||||
toggler(state.command_palette_enabled_draft)
|
||||
.on_toggle(Message::SetCommandPaletteEnabled),
|
||||
]
|
||||
.align_y(Alignment::Center),
|
||||
),
|
||||
rule::horizontal(1),
|
||||
row![
|
||||
container(text("Command").size(13)).width(180),
|
||||
@@ -10484,10 +10460,14 @@ fn command_palette_panel(state: &Moorly) -> Element<'_, Message> {
|
||||
.spacing(8);
|
||||
|
||||
for command in Command::ALL {
|
||||
rows = rows.push(command_palette_row(
|
||||
&state.typography.caption,
|
||||
command.label(state),
|
||||
command.description(state),
|
||||
let label = command.label(state);
|
||||
let description = command.description(state);
|
||||
let search = format!("{label} {description}");
|
||||
|
||||
rows = rows.push(dim_setting(
|
||||
state,
|
||||
&search,
|
||||
command_palette_row(&state.typography.caption, label, description),
|
||||
));
|
||||
}
|
||||
|
||||
@@ -10503,10 +10483,16 @@ fn command_palette_panel(state: &Moorly) -> Element<'_, Message> {
|
||||
"Focuses the matching window, or moves the active tab into it",
|
||||
),
|
||||
] {
|
||||
rows = rows.push(command_palette_row(
|
||||
&state.typography.caption,
|
||||
label.to_owned(),
|
||||
description.to_owned(),
|
||||
let search = format!("{label} {description}");
|
||||
|
||||
rows = rows.push(dim_setting(
|
||||
state,
|
||||
&search,
|
||||
command_palette_row(
|
||||
&state.typography.caption,
|
||||
label.to_owned(),
|
||||
description.to_owned(),
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
@@ -10562,31 +10548,41 @@ fn parse_scrollback(value: &str) -> Option<usize> {
|
||||
|
||||
fn general_panel(state: &Moorly) -> Element<'_, Message> {
|
||||
let mut panel = column![
|
||||
row![
|
||||
styled_text(&state.typography.h3, "Fade In/Fade out animation"),
|
||||
space::horizontal(),
|
||||
toggler(state.fade_settings_draft).on_toggle(Message::SetFadeSettings),
|
||||
]
|
||||
.align_y(Alignment::Center),
|
||||
row![
|
||||
styled_text(&state.typography.h3, "Close window to tray"),
|
||||
space::horizontal(),
|
||||
toggler(state.close_to_tray_draft).on_toggle(Message::SetCloseToTray),
|
||||
]
|
||||
.align_y(Alignment::Center),
|
||||
dim_setting(
|
||||
state,
|
||||
"Fade In/Fade out animation fade animation",
|
||||
row![
|
||||
styled_text(&state.typography.h3, "Fade In/Fade out animation"),
|
||||
space::horizontal(),
|
||||
toggler(state.fade_settings_draft).on_toggle(Message::SetFadeSettings),
|
||||
]
|
||||
.align_y(Alignment::Center),
|
||||
),
|
||||
dim_setting(
|
||||
state,
|
||||
"Close window to tray close tray",
|
||||
row![
|
||||
styled_text(&state.typography.h3, "Close window to tray"),
|
||||
space::horizontal(),
|
||||
toggler(state.close_to_tray_draft).on_toggle(Message::SetCloseToTray),
|
||||
]
|
||||
.align_y(Alignment::Center),
|
||||
),
|
||||
]
|
||||
.spacing(12);
|
||||
|
||||
// Wayland clients cannot query whether their window was minimized.
|
||||
if !needs_window_recreation() {
|
||||
panel = panel.push(
|
||||
panel = panel.push(dim_setting(
|
||||
state,
|
||||
"Minimize window to tray minimize tray",
|
||||
row![
|
||||
styled_text(&state.typography.h3, "Minimize window to tray"),
|
||||
space::horizontal(),
|
||||
toggler(state.minimize_to_tray_draft).on_toggle(Message::SetMinimizeToTray),
|
||||
]
|
||||
.align_y(Alignment::Center),
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
let mut tray_style_picker = row![].spacing(6);
|
||||
@@ -10602,7 +10598,9 @@ fn general_panel(state: &Moorly) -> Element<'_, Message> {
|
||||
});
|
||||
}
|
||||
|
||||
panel = panel.push(
|
||||
panel = panel.push(dim_setting(
|
||||
state,
|
||||
"System Tray tray icon style icon",
|
||||
column![
|
||||
styled_text(&state.typography.h2, "System Tray"),
|
||||
row![
|
||||
@@ -10620,17 +10618,21 @@ fn general_panel(state: &Moorly) -> Element<'_, Message> {
|
||||
.align_y(Alignment::Center),
|
||||
]
|
||||
.spacing(8),
|
||||
);
|
||||
));
|
||||
|
||||
panel = panel.push(
|
||||
panel = panel.push(dim_setting(
|
||||
state,
|
||||
"Right-click behavior right click copy paste context menu",
|
||||
column![
|
||||
styled_text(&state.typography.h2, "Right-click behavior"),
|
||||
right_click_behavior_picker(state),
|
||||
]
|
||||
.spacing(8),
|
||||
);
|
||||
));
|
||||
|
||||
panel = panel.push(
|
||||
panel = panel.push(dim_setting(
|
||||
state,
|
||||
"Terminal scrollback size history lines",
|
||||
column![
|
||||
styled_text(&state.typography.h2, "Terminal"),
|
||||
row![
|
||||
@@ -10656,7 +10658,7 @@ fn general_panel(state: &Moorly) -> Element<'_, Message> {
|
||||
.align_y(Alignment::Center),
|
||||
]
|
||||
.spacing(8),
|
||||
);
|
||||
));
|
||||
|
||||
let login_action: Element<'_, Message> = if state.autostart_at_login {
|
||||
button("Remove autostart")
|
||||
@@ -10672,7 +10674,9 @@ fn general_panel(state: &Moorly) -> Element<'_, Message> {
|
||||
.into()
|
||||
};
|
||||
|
||||
panel = panel.push(
|
||||
panel = panel.push(dim_setting(
|
||||
state,
|
||||
"Autostart at login start automatically sign in",
|
||||
row![
|
||||
column![
|
||||
styled_text(&state.typography.h2, "Autostart at login"),
|
||||
@@ -10686,7 +10690,7 @@ fn general_panel(state: &Moorly) -> Element<'_, Message> {
|
||||
login_action,
|
||||
]
|
||||
.align_y(Alignment::Center),
|
||||
);
|
||||
));
|
||||
|
||||
panel.into()
|
||||
}
|
||||
@@ -11066,30 +11070,41 @@ fn startup_panel(state: &Moorly) -> Element<'_, Message> {
|
||||
.style(theme::positive_option);
|
||||
|
||||
column![
|
||||
row![
|
||||
styled_text(&state.typography.h3, "Show Start tab at startup"),
|
||||
space::horizontal(),
|
||||
toggler(state.show_start_tab_draft).on_toggle(Message::SetShowStartTab),
|
||||
]
|
||||
.align_y(Alignment::Center),
|
||||
styled_text(&state.typography.h1, "Autostarting profiles"),
|
||||
styled_text(
|
||||
&state.typography.caption,
|
||||
"Profiles in this list start automatically when Moorly launches. \
|
||||
They are started in order from top to bottom.",
|
||||
dim_setting(
|
||||
state,
|
||||
"Show Start tab at startup start tab",
|
||||
row![
|
||||
styled_text(&state.typography.h3, "Show Start tab at startup"),
|
||||
space::horizontal(),
|
||||
toggler(state.show_start_tab_draft).on_toggle(Message::SetShowStartTab),
|
||||
]
|
||||
.align_y(Alignment::Center),
|
||||
),
|
||||
dim_setting(
|
||||
state,
|
||||
"Autostarting profiles autostart start automatically launch order quick terminal PowerShell",
|
||||
column![
|
||||
styled_text(&state.typography.h1, "Autostarting profiles"),
|
||||
styled_text(
|
||||
&state.typography.caption,
|
||||
"Profiles in this list start automatically when Moorly launches. \
|
||||
They are started in order from top to bottom.",
|
||||
),
|
||||
list,
|
||||
row![
|
||||
pick_list(
|
||||
choices,
|
||||
state.autostart_choice.clone(),
|
||||
Message::AutostartChoiceSelected
|
||||
)
|
||||
.width(Length::Fill),
|
||||
add,
|
||||
]
|
||||
.spacing(8)
|
||||
.align_y(Alignment::Center),
|
||||
]
|
||||
.spacing(12),
|
||||
),
|
||||
list,
|
||||
row![
|
||||
pick_list(
|
||||
choices,
|
||||
state.autostart_choice.clone(),
|
||||
Message::AutostartChoiceSelected
|
||||
)
|
||||
.width(Length::Fill),
|
||||
add,
|
||||
]
|
||||
.spacing(8)
|
||||
.align_y(Alignment::Center),
|
||||
]
|
||||
.spacing(12)
|
||||
.into()
|
||||
@@ -11098,31 +11113,55 @@ fn startup_panel(state: &Moorly) -> Element<'_, Message> {
|
||||
/// Appearance settings that are edited as a draft until saved.
|
||||
fn appearance_panel(state: &Moorly) -> Element<'_, Message> {
|
||||
column![
|
||||
theme_picker(state),
|
||||
typography_panel(state),
|
||||
advanced_panel(state),
|
||||
dim_setting(
|
||||
state,
|
||||
"Theme colors palette appearance light dark",
|
||||
theme_picker(state),
|
||||
),
|
||||
dim_setting(
|
||||
state,
|
||||
"Typography font size bold italic underline strikethrough text H1 H2 H3 Caption Terminal SSH",
|
||||
typography_panel(state),
|
||||
),
|
||||
dim_setting(
|
||||
state,
|
||||
"Advanced theme colors Accent color Active tab outline Main background Sidebar background Text color Border color Profile list background Visible profiles Hidden profile save undo delete",
|
||||
advanced_panel(state),
|
||||
),
|
||||
styled_text(&state.typography.h2, "Tab bar"),
|
||||
row![
|
||||
styled_text(&state.typography.h3, "Show new Session Button"),
|
||||
space::horizontal(),
|
||||
toggler(state.show_new_session_button_draft)
|
||||
.on_toggle(Message::SetShowNewSessionButton),
|
||||
]
|
||||
.align_y(Alignment::Center),
|
||||
row![
|
||||
styled_text(&state.typography.h3, "Hide tab close icon"),
|
||||
space::horizontal(),
|
||||
toggler(state.hide_tab_close_draft).on_toggle(Message::SetHideTabClose),
|
||||
]
|
||||
.align_y(Alignment::Center),
|
||||
dim_setting(
|
||||
state,
|
||||
"Show new Session Button tab bar new session",
|
||||
row![
|
||||
styled_text(&state.typography.h3, "Show new Session Button"),
|
||||
space::horizontal(),
|
||||
toggler(state.show_new_session_button_draft)
|
||||
.on_toggle(Message::SetShowNewSessionButton),
|
||||
]
|
||||
.align_y(Alignment::Center),
|
||||
),
|
||||
dim_setting(
|
||||
state,
|
||||
"Hide tab close icon tab bar close",
|
||||
row![
|
||||
styled_text(&state.typography.h3, "Hide tab close icon"),
|
||||
space::horizontal(),
|
||||
toggler(state.hide_tab_close_draft).on_toggle(Message::SetHideTabClose),
|
||||
]
|
||||
.align_y(Alignment::Center),
|
||||
),
|
||||
styled_text(&state.typography.h2, "Command Palette"),
|
||||
row![
|
||||
styled_text(&state.typography.h3, "Show command palette description"),
|
||||
space::horizontal(),
|
||||
toggler(state.show_command_palette_description_draft)
|
||||
.on_toggle(Message::SetShowCommandPaletteDescription),
|
||||
]
|
||||
.align_y(Alignment::Center),
|
||||
dim_setting(
|
||||
state,
|
||||
"Show command palette description command palette",
|
||||
row![
|
||||
styled_text(&state.typography.h3, "Show command palette description"),
|
||||
space::horizontal(),
|
||||
toggler(state.show_command_palette_description_draft)
|
||||
.on_toggle(Message::SetShowCommandPaletteDescription),
|
||||
]
|
||||
.align_y(Alignment::Center),
|
||||
),
|
||||
]
|
||||
.spacing(12)
|
||||
.into()
|
||||
@@ -11264,6 +11303,70 @@ fn profile_context_menu(
|
||||
)
|
||||
}
|
||||
|
||||
/// Searchable text for a settings category, used to dim non-matching tabs in
|
||||
/// the settings menu.
|
||||
fn settings_section_search_text(section: SettingsSection) -> &'static str {
|
||||
match section {
|
||||
SettingsSection::General => {
|
||||
"Fade In/Fade out animation animation Close window to tray minimize window to tray \
|
||||
System Tray tray icon style Right-click behavior copy paste context menu Terminal \
|
||||
Scrollback size history Autostart at login"
|
||||
}
|
||||
SettingsSection::Startup => {
|
||||
"Show Start tab at startup Autostarting profiles autostart order quick terminal PowerShell"
|
||||
}
|
||||
SettingsSection::Appearance => {
|
||||
"Theme colors palette Accent color Active tab outline Main background Sidebar background \
|
||||
Text color Border color Profile list background Visible profiles Hidden profile \
|
||||
Typography font size bold italic underline strikethrough H1 H2 H3 Caption Terminal SSH \
|
||||
Advanced theme Tab bar Show new Session Button Hide tab close icon Command Palette \
|
||||
Show command palette description"
|
||||
}
|
||||
SettingsSection::Shortcuts => {
|
||||
"Shortcuts Settings Quit Show/hide window Command palette Quick terminal Quick SSH \
|
||||
Close active tab Minimize all windows Copy terminal text Paste into terminal"
|
||||
}
|
||||
SettingsSection::CommandPalette => {
|
||||
"Command Palette Enable command palette Command Description Profile name Tab title Window title"
|
||||
}
|
||||
SettingsSection::Profiles => {
|
||||
"Profiles Folders Filter Add profile edit delete hide unhide copy move"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether `text` contains the current settings search.
|
||||
fn settings_search_matches(state: &Moorly, text: &str) -> bool {
|
||||
let query = state.settings_search.trim().to_lowercase();
|
||||
|
||||
query.is_empty() || text.to_lowercase().contains(&query)
|
||||
}
|
||||
|
||||
/// Fades an option that does not match the active settings search. The overlay
|
||||
/// is inert, so the control underneath still works.
|
||||
fn dim_setting<'a>(
|
||||
state: &Moorly,
|
||||
text: &str,
|
||||
content: impl Into<Element<'a, Message>>,
|
||||
) -> Element<'a, Message> {
|
||||
let content = content.into();
|
||||
|
||||
if settings_search_matches(state, text) {
|
||||
return content;
|
||||
}
|
||||
|
||||
let background = state.colors[ColorOption::MainBackground.index()].scale_alpha(0.72);
|
||||
let overlay = container(space::horizontal())
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fill)
|
||||
.style(move |_| container::Style {
|
||||
background: Some(background.into()),
|
||||
..container::Style::default()
|
||||
});
|
||||
|
||||
stack![content, overlay].width(Length::Fill).into()
|
||||
}
|
||||
|
||||
fn settings_dirty(state: &Moorly) -> bool {
|
||||
state.show_start_tab_draft != state.show_start_tab
|
||||
|| state.autostart_profiles_draft != state.autostart_profiles
|
||||
@@ -11319,11 +11422,27 @@ fn settings_page(state: &Moorly, window: window::Id) -> Element<'_, Message> {
|
||||
}
|
||||
};
|
||||
|
||||
let menu =
|
||||
container(column(SettingsSection::ALL.map(|section| menu_item(section).into())).spacing(2))
|
||||
.width(menu_width)
|
||||
.height(Length::Fill)
|
||||
.padding(8);
|
||||
let section_items = column(SettingsSection::ALL.map(|section| {
|
||||
let search = format!(
|
||||
"{} {}",
|
||||
section.label(),
|
||||
settings_section_search_text(section)
|
||||
);
|
||||
|
||||
dim_setting(state, &search, menu_item(section))
|
||||
}))
|
||||
.spacing(2);
|
||||
|
||||
let search = text_input("Search settings", &state.settings_search)
|
||||
.on_input(Message::SettingsSearchChanged)
|
||||
.padding(6)
|
||||
.style(theme::filter_field)
|
||||
.width(Length::Fill);
|
||||
|
||||
let menu = container(column![search, section_items].spacing(8))
|
||||
.width(menu_width)
|
||||
.height(Length::Fill)
|
||||
.padding(8);
|
||||
|
||||
let scrolls = state.settings_section != SettingsSection::Profiles;
|
||||
|
||||
@@ -11353,7 +11472,11 @@ fn settings_page(state: &Moorly, window: window::Id) -> Element<'_, Message> {
|
||||
content = content.push(command_palette_panel(state));
|
||||
}
|
||||
if state.settings_section == SettingsSection::Profiles {
|
||||
content = content.push(profiles_panel(state, window, true));
|
||||
content = content.push(dim_setting(
|
||||
state,
|
||||
settings_section_search_text(SettingsSection::Profiles),
|
||||
profiles_panel(state, window, true),
|
||||
));
|
||||
}
|
||||
|
||||
let body: Element<'_, Message> = if scrolls {
|
||||
@@ -13096,6 +13219,7 @@ mod tests {
|
||||
saved_shortcuts: super::Shortcuts::default(),
|
||||
shortcut_capture: None,
|
||||
settings_section: super::SettingsSection::default(),
|
||||
settings_search: String::new(),
|
||||
pending_settings_section: None,
|
||||
show_start_tab: true,
|
||||
show_start_tab_draft: true,
|
||||
@@ -13677,6 +13801,39 @@ mod tests {
|
||||
assert_eq!(state.scrollback_size, super::terminal::MAX_SCROLLBACK_SIZE);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn settings_search_matches_options_and_categories() {
|
||||
let mut state = state();
|
||||
state.settings_search = "scroll".to_owned();
|
||||
|
||||
assert!(super::settings_search_matches(&state, "Scrollback size"));
|
||||
assert!(!super::settings_search_matches(&state, "Typography"));
|
||||
assert!(super::settings_search_matches(
|
||||
&state,
|
||||
super::settings_section_search_text(super::SettingsSection::General)
|
||||
));
|
||||
assert!(!super::settings_search_matches(
|
||||
&state,
|
||||
super::settings_section_search_text(super::SettingsSection::Appearance)
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dimmed_settings_options_still_respond_to_clicks() {
|
||||
let mut state = state();
|
||||
window_state_mut(&mut state).active_tab = Some(Tab::Settings);
|
||||
state.settings_section = super::SettingsSection::Shortcuts;
|
||||
state.settings_search = "no such setting".to_owned();
|
||||
|
||||
let mut ui = iced_test::simulator(super::view(&state, test_window()));
|
||||
ui.click("Default").unwrap();
|
||||
|
||||
assert!(
|
||||
ui.into_messages()
|
||||
.any(|message| matches!(message, Message::DefaultShortcut(_)))
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hiding_tab_close_waits_for_save_or_undo() {
|
||||
let mut state = state();
|
||||
|
||||
Reference in new issue
Block a user