fix: Updated the name of the should_ignore_quit_key to ignore_special_keys_for_textbox_input to give a better idea of what the flag is used for; also added alt keybinding for backspace
This commit is contained in:
1 parent
f25829f3c1
commit
cf00d7992e
80 files changed
+584
-435
No files matched your search
@@ -66,8 +66,8 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for EditIndexerHandler<'
|
||||
EDIT_INDEXER_BLOCKS.contains(&active_block)
|
||||
}
|
||||
|
||||
fn ignore_alt_navigation(&self) -> bool {
|
||||
self.app.should_ignore_quit_key
|
||||
fn ignore_special_keys(&self) -> bool {
|
||||
self.app.ignore_special_keys_for_textbox_input
|
||||
}
|
||||
|
||||
fn new(
|
||||
@@ -361,7 +361,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for EditIndexerHandler<'
|
||||
| ActiveRadarrBlock::EditIndexerSeedRatioInput
|
||||
| ActiveRadarrBlock::EditIndexerTagsInput => {
|
||||
self.app.push_navigation_stack(selected_block.into());
|
||||
self.app.should_ignore_quit_key = true;
|
||||
self.app.ignore_special_keys_for_textbox_input = true;
|
||||
}
|
||||
ActiveRadarrBlock::EditIndexerPriorityInput => self
|
||||
.app
|
||||
@@ -407,7 +407,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for EditIndexerHandler<'
|
||||
| ActiveRadarrBlock::EditIndexerSeedRatioInput
|
||||
| ActiveRadarrBlock::EditIndexerTagsInput => {
|
||||
self.app.pop_navigation_stack();
|
||||
self.app.should_ignore_quit_key = false;
|
||||
self.app.ignore_special_keys_for_textbox_input = false;
|
||||
}
|
||||
ActiveRadarrBlock::EditIndexerPriorityInput => self.app.pop_navigation_stack(),
|
||||
_ => (),
|
||||
@@ -428,7 +428,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for EditIndexerHandler<'
|
||||
| ActiveRadarrBlock::EditIndexerPriorityInput
|
||||
| ActiveRadarrBlock::EditIndexerTagsInput => {
|
||||
self.app.pop_navigation_stack();
|
||||
self.app.should_ignore_quit_key = false;
|
||||
self.app.ignore_special_keys_for_textbox_input = false;
|
||||
}
|
||||
_ => self.app.pop_navigation_stack(),
|
||||
}
|
||||
|
||||
@@ -1003,7 +1003,7 @@ mod tests {
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), block.into());
|
||||
assert!(app.should_ignore_quit_key);
|
||||
assert!(app.ignore_special_keys_for_textbox_input);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1028,7 +1028,7 @@ mod tests {
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::EditIndexerPriorityInput.into()
|
||||
);
|
||||
assert!(!app.should_ignore_quit_key);
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1194,7 +1194,7 @@ mod tests {
|
||||
fn test_edit_indexer_name_input_submit() {
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveRadarrBlock::Indexers.into());
|
||||
app.should_ignore_quit_key = true;
|
||||
app.ignore_special_keys_for_textbox_input = true;
|
||||
app.data.radarr_data.edit_indexer_modal = Some(EditIndexerModal {
|
||||
name: "Test".into(),
|
||||
..EditIndexerModal::default()
|
||||
@@ -1210,7 +1210,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert!(!app.should_ignore_quit_key);
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
assert!(!app
|
||||
.data
|
||||
.radarr_data
|
||||
@@ -1230,7 +1230,7 @@ mod tests {
|
||||
fn test_edit_indexer_url_input_submit() {
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveRadarrBlock::Indexers.into());
|
||||
app.should_ignore_quit_key = true;
|
||||
app.ignore_special_keys_for_textbox_input = true;
|
||||
app.data.radarr_data.edit_indexer_modal = Some(EditIndexerModal {
|
||||
url: "Test".into(),
|
||||
..EditIndexerModal::default()
|
||||
@@ -1246,7 +1246,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert!(!app.should_ignore_quit_key);
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
assert!(!app
|
||||
.data
|
||||
.radarr_data
|
||||
@@ -1266,7 +1266,7 @@ mod tests {
|
||||
fn test_edit_indexer_api_key_input_submit() {
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveRadarrBlock::Indexers.into());
|
||||
app.should_ignore_quit_key = true;
|
||||
app.ignore_special_keys_for_textbox_input = true;
|
||||
app.data.radarr_data.edit_indexer_modal = Some(EditIndexerModal {
|
||||
api_key: "Test".into(),
|
||||
..EditIndexerModal::default()
|
||||
@@ -1282,7 +1282,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert!(!app.should_ignore_quit_key);
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
assert!(!app
|
||||
.data
|
||||
.radarr_data
|
||||
@@ -1302,7 +1302,7 @@ mod tests {
|
||||
fn test_edit_indexer_seed_ratio_input_submit() {
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveRadarrBlock::Indexers.into());
|
||||
app.should_ignore_quit_key = true;
|
||||
app.ignore_special_keys_for_textbox_input = true;
|
||||
app.data.radarr_data.edit_indexer_modal = Some(EditIndexerModal {
|
||||
seed_ratio: "Test".into(),
|
||||
..EditIndexerModal::default()
|
||||
@@ -1318,7 +1318,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert!(!app.should_ignore_quit_key);
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
assert!(!app
|
||||
.data
|
||||
.radarr_data
|
||||
@@ -1338,7 +1338,7 @@ mod tests {
|
||||
fn test_edit_indexer_tags_input_submit() {
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveRadarrBlock::Indexers.into());
|
||||
app.should_ignore_quit_key = true;
|
||||
app.ignore_special_keys_for_textbox_input = true;
|
||||
app.data.radarr_data.edit_indexer_modal = Some(EditIndexerModal {
|
||||
tags: "Test".into(),
|
||||
..EditIndexerModal::default()
|
||||
@@ -1354,7 +1354,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert!(!app.should_ignore_quit_key);
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
assert!(!app
|
||||
.data
|
||||
.radarr_data
|
||||
@@ -1418,12 +1418,12 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveRadarrBlock::Indexers.into());
|
||||
app.push_navigation_stack(active_radarr_block.into());
|
||||
app.data.radarr_data.edit_indexer_modal = Some(EditIndexerModal::default());
|
||||
app.should_ignore_quit_key = true;
|
||||
app.ignore_special_keys_for_textbox_input = true;
|
||||
|
||||
EditIndexerHandler::new(ESC_KEY, &mut app, active_radarr_block, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Indexers.into());
|
||||
assert!(!app.should_ignore_quit_key);
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
assert_eq!(
|
||||
app.data.radarr_data.edit_indexer_modal,
|
||||
Some(EditIndexerModal::default())
|
||||
@@ -1795,11 +1795,11 @@ mod tests {
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
fn test_edit_indexer_handler_ignore_alt_navigation(
|
||||
#[values(true, false)] should_ignore_quit_key: bool,
|
||||
fn test_edit_indexer_handler_ignore_special_keys(
|
||||
#[values(true, false)] ignore_special_keys_for_textbox_input: bool,
|
||||
) {
|
||||
let mut app = App::test_default();
|
||||
app.should_ignore_quit_key = should_ignore_quit_key;
|
||||
app.ignore_special_keys_for_textbox_input = ignore_special_keys_for_textbox_input;
|
||||
let handler = EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
@@ -1807,7 +1807,10 @@ mod tests {
|
||||
None,
|
||||
);
|
||||
|
||||
assert_eq!(handler.ignore_alt_navigation(), should_ignore_quit_key);
|
||||
assert_eq!(
|
||||
handler.ignore_special_keys(),
|
||||
ignore_special_keys_for_textbox_input
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -38,8 +38,8 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for IndexerSettingsHandl
|
||||
INDEXER_SETTINGS_BLOCKS.contains(&active_block)
|
||||
}
|
||||
|
||||
fn ignore_alt_navigation(&self) -> bool {
|
||||
self.app.should_ignore_quit_key
|
||||
fn ignore_special_keys(&self) -> bool {
|
||||
self.app.ignore_special_keys_for_textbox_input
|
||||
}
|
||||
|
||||
fn new(
|
||||
@@ -212,7 +212,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for IndexerSettingsHandl
|
||||
self.app.push_navigation_stack(
|
||||
ActiveRadarrBlock::IndexerSettingsWhitelistedSubtitleTagsInput.into(),
|
||||
);
|
||||
self.app.should_ignore_quit_key = true;
|
||||
self.app.ignore_special_keys_for_textbox_input = true;
|
||||
}
|
||||
ActiveRadarrBlock::IndexerSettingsTogglePreferIndexerFlags => {
|
||||
let indexer_settings = self.app.data.radarr_data.indexer_settings.as_mut().unwrap();
|
||||
@@ -229,7 +229,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for IndexerSettingsHandl
|
||||
}
|
||||
ActiveRadarrBlock::IndexerSettingsWhitelistedSubtitleTagsInput => {
|
||||
self.app.pop_navigation_stack();
|
||||
self.app.should_ignore_quit_key = false;
|
||||
self.app.ignore_special_keys_for_textbox_input = false;
|
||||
}
|
||||
ActiveRadarrBlock::IndexerSettingsMinimumAgeInput
|
||||
| ActiveRadarrBlock::IndexerSettingsRetentionInput
|
||||
@@ -249,7 +249,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for IndexerSettingsHandl
|
||||
}
|
||||
ActiveRadarrBlock::IndexerSettingsWhitelistedSubtitleTagsInput => {
|
||||
self.app.pop_navigation_stack();
|
||||
self.app.should_ignore_quit_key = false;
|
||||
self.app.ignore_special_keys_for_textbox_input = false;
|
||||
}
|
||||
_ => self.app.pop_navigation_stack(),
|
||||
}
|
||||
|
||||
@@ -603,7 +603,7 @@ mod tests {
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::IndexerSettingsWhitelistedSubtitleTagsInput.into()
|
||||
);
|
||||
assert!(app.should_ignore_quit_key);
|
||||
assert!(app.ignore_special_keys_for_textbox_input);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -717,7 +717,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_edit_indexer_settings_whitelisted_subtitle_tags_input_submit() {
|
||||
let mut app = App::test_default();
|
||||
app.should_ignore_quit_key = true;
|
||||
app.ignore_special_keys_for_textbox_input = true;
|
||||
app.data.radarr_data.indexer_settings = Some(IndexerSettings {
|
||||
whitelisted_hardcoded_subs: "Test tags".into(),
|
||||
..IndexerSettings::default()
|
||||
@@ -735,7 +735,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert!(!app.should_ignore_quit_key);
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
assert!(!app
|
||||
.data
|
||||
.radarr_data
|
||||
@@ -815,7 +815,7 @@ mod tests {
|
||||
ActiveRadarrBlock::IndexerSettingsWhitelistedSubtitleTagsInput.into(),
|
||||
);
|
||||
app.data.radarr_data.indexer_settings = Some(IndexerSettings::default());
|
||||
app.should_ignore_quit_key = true;
|
||||
app.ignore_special_keys_for_textbox_input = true;
|
||||
|
||||
IndexerSettingsHandler::new(
|
||||
ESC_KEY,
|
||||
@@ -826,7 +826,7 @@ mod tests {
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Indexers.into());
|
||||
assert!(!app.should_ignore_quit_key);
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
assert_eq!(
|
||||
app.data.radarr_data.indexer_settings,
|
||||
Some(IndexerSettings::default())
|
||||
@@ -972,11 +972,11 @@ mod tests {
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
fn test_indexer_settings_handler_ignore_alt_navigation(
|
||||
#[values(true, false)] should_ignore_quit_key: bool,
|
||||
fn test_indexer_settings_handler_ignore_special_keys(
|
||||
#[values(true, false)] ignore_special_keys_for_textbox_input: bool,
|
||||
) {
|
||||
let mut app = App::test_default();
|
||||
app.should_ignore_quit_key = should_ignore_quit_key;
|
||||
app.ignore_special_keys_for_textbox_input = ignore_special_keys_for_textbox_input;
|
||||
let handler = IndexerSettingsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
@@ -984,7 +984,10 @@ mod tests {
|
||||
None,
|
||||
);
|
||||
|
||||
assert_eq!(handler.ignore_alt_navigation(), should_ignore_quit_key);
|
||||
assert_eq!(
|
||||
handler.ignore_special_keys(),
|
||||
ignore_special_keys_for_textbox_input
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -634,11 +634,11 @@ mod tests {
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
fn test_indexers_handler_ignore_alt_navigation(
|
||||
#[values(true, false)] should_ignore_quit_key: bool,
|
||||
fn test_indexers_handler_ignore_special_keys(
|
||||
#[values(true, false)] ignore_special_keys_for_textbox_input: bool,
|
||||
) {
|
||||
let mut app = App::test_default();
|
||||
app.should_ignore_quit_key = should_ignore_quit_key;
|
||||
app.ignore_special_keys_for_textbox_input = ignore_special_keys_for_textbox_input;
|
||||
let handler = IndexersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
@@ -646,7 +646,10 @@ mod tests {
|
||||
None,
|
||||
);
|
||||
|
||||
assert_eq!(handler.ignore_alt_navigation(), should_ignore_quit_key);
|
||||
assert_eq!(
|
||||
handler.ignore_special_keys(),
|
||||
ignore_special_keys_for_textbox_input
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -69,8 +69,8 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for IndexersHandler<'a,
|
||||
|| INDEXERS_BLOCKS.contains(&active_block)
|
||||
}
|
||||
|
||||
fn ignore_alt_navigation(&self) -> bool {
|
||||
self.app.should_ignore_quit_key
|
||||
fn ignore_special_keys(&self) -> bool {
|
||||
self.app.ignore_special_keys_for_textbox_input
|
||||
}
|
||||
|
||||
fn new(
|
||||
|
||||
@@ -48,8 +48,8 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for TestAllIndexersHandl
|
||||
active_block == ActiveRadarrBlock::TestAllIndexers
|
||||
}
|
||||
|
||||
fn ignore_alt_navigation(&self) -> bool {
|
||||
self.app.should_ignore_quit_key
|
||||
fn ignore_special_keys(&self) -> bool {
|
||||
self.app.ignore_special_keys_for_textbox_input
|
||||
}
|
||||
|
||||
fn new(
|
||||
|
||||
@@ -50,11 +50,11 @@ mod tests {
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
fn test_test_all_indexers_handler_ignore_alt_navigation(
|
||||
#[values(true, false)] should_ignore_quit_key: bool,
|
||||
fn test_test_all_indexers_handler_ignore_special_keys(
|
||||
#[values(true, false)] ignore_special_keys_for_textbox_input: bool,
|
||||
) {
|
||||
let mut app = App::test_default();
|
||||
app.should_ignore_quit_key = should_ignore_quit_key;
|
||||
app.ignore_special_keys_for_textbox_input = ignore_special_keys_for_textbox_input;
|
||||
let handler = TestAllIndexersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
@@ -62,7 +62,10 @@ mod tests {
|
||||
None,
|
||||
);
|
||||
|
||||
assert_eq!(handler.ignore_alt_navigation(), should_ignore_quit_key);
|
||||
assert_eq!(
|
||||
handler.ignore_special_keys(),
|
||||
ignore_special_keys_for_textbox_input
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user