we compiled for now
This commit is contained in:
@@ -93,7 +93,7 @@ pub fn move_up(app_state: &mut AppState, login_state: &mut LoginState, register_
|
|||||||
register_state.set_current_field(last_field_index);
|
register_state.set_current_field(last_field_index);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
app_state.focused_button_index = app_state.general.selected_item.saturating_sub(1);
|
app_state.focused_button_index = app_state.focused_button_index.saturating_sub(1);
|
||||||
}
|
}
|
||||||
} else if app_state.ui.show_intro {
|
} else if app_state.ui.show_intro {
|
||||||
app_state.ui.intro_state.previous_option();
|
app_state.ui.intro_state.previous_option();
|
||||||
@@ -121,7 +121,7 @@ pub fn next_option(app_state: &mut AppState) { // Remove option_count parameter
|
|||||||
} else {
|
} else {
|
||||||
// Get option count from state instead of parameter
|
// Get option count from state instead of parameter
|
||||||
let option_count = app_state.profile_tree.profiles.len();
|
let option_count = app_state.profile_tree.profiles.len();
|
||||||
app_state.general.current_option = (app_state.general.current_option + 1) % option_count;
|
app_state.focused_button_index = (app_state.focused_button_index + 1) % option_count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,10 +130,10 @@ pub fn previous_option(app_state: &mut AppState) {
|
|||||||
app_state.ui.intro_state.previous_option();
|
app_state.ui.intro_state.previous_option();
|
||||||
} else {
|
} else {
|
||||||
let option_count = app_state.profile_tree.profiles.len();
|
let option_count = app_state.profile_tree.profiles.len();
|
||||||
app_state.general.current_option = if app_state.general.current_option == 0 {
|
app_state.focused_button_index = if app_state.focused_button_index == 0 {
|
||||||
option_count.saturating_sub(1)
|
option_count.saturating_sub(1)
|
||||||
} else {
|
} else {
|
||||||
app_state.general.current_option - 1
|
app_state.focused_button_index - 1
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,5 +34,32 @@ impl AdminState {
|
|||||||
self.list_state.select(new_selection);
|
self.list_state.select(new_selection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Selects the next profile in the list, wrapping around.
|
||||||
|
pub fn next(&mut self) {
|
||||||
|
if self.profiles.is_empty() {
|
||||||
|
self.list_state.select(None);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let i = match self.list_state.selected() {
|
||||||
|
Some(i) => if i >= self.profiles.len() - 1 { 0 } else { i + 1 },
|
||||||
|
None => 0,
|
||||||
|
};
|
||||||
|
self.list_state.select(Some(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Selects the previous profile in the list, wrapping around.
|
||||||
|
pub fn previous(&mut self) {
|
||||||
|
if self.profiles.is_empty() {
|
||||||
|
self.list_state.select(None);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let i = match self.list_state.selected() {
|
||||||
|
Some(i) => if i == 0 { self.profiles.len() - 1 } else { i - 1 },
|
||||||
|
None => self.profiles.len() - 1,
|
||||||
|
};
|
||||||
|
self.list_state.select(Some(i));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user