fixing is_edit_mode flag removal

This commit is contained in:
filipriec
2025-08-24 16:37:30 +02:00
parent f6c2fd627f
commit b2a82fba30
7 changed files with 210 additions and 134 deletions

View File

@@ -544,7 +544,7 @@ pub async fn run_ui() -> Result<()> {
if let Page::Form(form_state) = &mut router.current {
if !table_just_switched {
if position_changed && !event_handler.is_edit_mode {
if position_changed && !matches!(app_state.form_editor.as_ref().map(|e| e.mode()), Some(canvas::AppMode::Edit)) {
position_logic_needs_redraw = true;
if let Some(form_state) = app_state.form_state_mut() {
@@ -582,7 +582,7 @@ pub async fn run_ui() -> Result<()> {
form_state.current_cursor_pos =
event_handler.ideal_cursor_column.min(max_cursor_pos);
}
} else if !position_changed && !event_handler.is_edit_mode {
} else if !position_changed && !matches!(app_state.form_editor.as_ref().map(|e| e.mode()), Some(canvas::AppMode::Edit)) {
if let Some(form_state) = app_state.form_state_mut() {
let current_input_str = form_state.get_current_input();
let current_input_len = current_input_str.chars().count();
@@ -597,7 +597,7 @@ pub async fn run_ui() -> Result<()> {
}
}
} else if let Page::Register(state) = &mut router.current {
if !event_handler.is_edit_mode {
if !matches!(app_state.form_editor.as_ref().map(|e| e.mode()), Some(canvas::AppMode::Edit)) {
let current_input = state.get_current_input();
let max_cursor_pos =
if !current_input.is_empty() { current_input.len() - 1 } else { 0 };
@@ -605,7 +605,7 @@ pub async fn run_ui() -> Result<()> {
event_handler.ideal_cursor_column.min(max_cursor_pos);
}
} else if let Page::Login(state) = &mut router.current {
if !event_handler.is_edit_mode {
if !matches!(app_state.form_editor.as_ref().map(|e| e.mode()), Some(canvas::AppMode::Edit)) {
let current_input = state.get_current_input();
let max_cursor_pos =
if !current_input.is_empty() { current_input.len() - 1 } else { 0 };
@@ -688,7 +688,6 @@ pub async fn run_ui() -> Result<()> {
&mut router,
&buffer_state,
&theme,
event_handler.is_edit_mode,
&event_handler.command_input,
event_handler.command_mode,
&event_handler.command_message,