working exactly as i want, now making the login up and down to work properly well
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
// src/tui/functions/login.rs
|
||||
use crate::state::pages::auth::AuthState;
|
||||
use crate::state::canvas_state::CanvasState;
|
||||
|
||||
pub async fn handle_move_up(
|
||||
auth_state: &mut AuthState,
|
||||
) -> Result<String, Box<dyn std::error::Error>> {
|
||||
if auth_state.current_field > 0 {
|
||||
auth_state.current_field -= 1;
|
||||
} else {
|
||||
// If at first field (username), cycle to button selection
|
||||
auth_state.current_field = 0;
|
||||
auth_state.return_selected = false;
|
||||
}
|
||||
|
||||
// Reset cursor position for the field
|
||||
auth_state.current_cursor_pos = auth_state.get_current_input().len();
|
||||
|
||||
Ok("".to_string())
|
||||
}
|
||||
|
||||
pub async fn handle_move_down(
|
||||
auth_state: &mut AuthState,
|
||||
) -> Result<String, Box<dyn std::error::Error>> {
|
||||
if auth_state.current_field < 1 {
|
||||
// Moving down from username to password
|
||||
auth_state.current_field += 1;
|
||||
|
||||
// Reset cursor position for the new field
|
||||
auth_state.current_cursor_pos = auth_state.get_current_input().len();
|
||||
} else {
|
||||
// Moving from password field to button selection
|
||||
auth_state.return_selected = false;
|
||||
}
|
||||
|
||||
Ok("".to_string())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user