diff --git a/src/state.rs b/src/state.rs index 66f99972..b59a5a90 100644 --- a/src/state.rs +++ b/src/state.rs @@ -202,8 +202,8 @@ impl AppState { self.refresh_tab(); } KeyCode::Char('/') => self.enter_search(), - KeyCode::Char('t') => self.theme = self.theme.next(), - KeyCode::Char('T') => self.theme = self.theme.prev(), + KeyCode::Char('t') => self.theme.next(), + KeyCode::Char('T') => self.theme.prev(), _ => {} }, Focus::List if key.kind != KeyEventKind::Release => match key.code { @@ -220,8 +220,8 @@ impl AppState { } KeyCode::Char('/') => self.enter_search(), KeyCode::Tab => self.focus = Focus::TabList, - KeyCode::Char('t') => self.theme = self.theme.next(), - KeyCode::Char('T') => self.theme = self.theme.prev(), + KeyCode::Char('t') => self.theme.next(), + KeyCode::Char('T') => self.theme.prev(), _ => {} }, _ => {} diff --git a/src/theme.rs b/src/theme.rs index bb5b6af2..84fa15b4 100644 --- a/src/theme.rs +++ b/src/theme.rs @@ -86,17 +86,15 @@ impl Theme { } impl Theme { - #[allow(unused)] - pub fn next(self) -> Self { - let position = self as usize; + pub fn next(&mut self) { + let position = *self as usize; let types = Theme::value_variants(); - types[(position + 1) % types.len()].into() + *self = types[(position + 1) % types.len()]; } - #[allow(unused)] - pub fn prev(self) -> Self { - let position = self as usize; + pub fn prev(&mut self) { + let position = *self as usize; let types = Theme::value_variants(); - types[(position + types.len() - 1) % types.len()].into() + *self = types[(position + types.len() - 1) % types.len()]; } }