diff --git a/client/src/components/admin/add_table.rs b/client/src/components/admin/add_table.rs index 0d9d964..c713480 100644 --- a/client/src/components/admin/add_table.rs +++ b/client/src/components/admin/add_table.rs @@ -249,7 +249,6 @@ pub fn render_add_table( .iter() .map(|h| Cell::from(*h).style(Style::default().fg(theme.accent))); let header = Row::new(header_cells).height(1).bottom_margin(1); - let columns_highlight_symbol = if add_table_state.current_focus == AddTableFocus::InsideColumnsTable { " > " } else { " " }; let columns_table = Table::new( column_rows, [ // Define constraints for 3 columns: Sel, Name, Type @@ -353,7 +352,6 @@ pub fn render_add_table( .iter() .map(|h| Cell::from(*h).style(Style::default().fg(theme.accent))); let index_header = Row::new(index_header_cells).height(1).bottom_margin(1); - let indexes_highlight_symbol = if add_table_state.current_focus == AddTableFocus::InsideIndexesTable { " > " } else { " " }; let indexes_table = Table::new(index_rows, [Constraint::Percentage(100)]) .header(index_header) @@ -399,7 +397,6 @@ pub fn render_add_table( .iter() .map(|h| Cell::from(*h).style(Style::default().fg(theme.accent))); let link_header = Row::new(link_header_cells).height(1).bottom_margin(1); - let links_highlight_symbol = if add_table_state.current_focus == AddTableFocus::InsideLinksTable { " > " } else { " " }; let links_table = Table::new(link_rows, [Constraint::Percentage(80), Constraint::Min(5)]) .header(link_header) diff --git a/client/src/components/admin/admin_panel_admin.rs b/client/src/components/admin/admin_panel_admin.rs index b741818..fa63365 100644 --- a/client/src/components/admin/admin_panel_admin.rs +++ b/client/src/components/admin/admin_panel_admin.rs @@ -66,8 +66,7 @@ pub fn render_admin_panel_admin( .enumerate() .map(|(idx, profile)| { // Check persistent selection for prefix, navigation state for style/highlight - let is_selected = admin_state.selected_profile_index == Some(idx); // Use persistent state for [*] - let is_navigated = admin_state.profile_list_state.selected() == Some(idx); // Use nav state for highlight/> + let is_selected = admin_state.selected_profile_index == Some(idx); let prefix = if is_selected { "[*] " } else { "[ ] " }; let style = if is_selected { // Style based on selection too Style::default().fg(theme.highlight).add_modifier(ratatui::style::Modifier::BOLD) diff --git a/client/src/components/auth/register.rs b/client/src/components/auth/register.rs index 54162f6..4d80161 100644 --- a/client/src/components/auth/register.rs +++ b/client/src/components/auth/register.rs @@ -152,7 +152,7 @@ pub fn render_register( let selected = state.get_selected_suggestion_index(); if !suggestions.is_empty() { if let Some(input_rect) = active_field_rect { - autocomplete::render_autocomplete_dropdown(f, input_rect, f.size(), theme, suggestions, selected); + autocomplete::render_autocomplete_dropdown(f, input_rect, f.area(), theme, suggestions, selected); } } } diff --git a/client/src/components/handlers/buffer_list.rs b/client/src/components/handlers/buffer_list.rs index 09a8590..079d2f1 100644 --- a/client/src/components/handlers/buffer_list.rs +++ b/client/src/components/handlers/buffer_list.rs @@ -4,7 +4,7 @@ use crate::config::colors::themes::Theme; use crate::state::app::buffer::BufferState; use ratatui::{ layout::{Alignment, Rect}, - style::{Style, Stylize}, + style::Style, text::{Line, Span}, widgets::Paragraph, Frame, diff --git a/client/src/functions/modes/edit/auth_e.rs b/client/src/functions/modes/edit/auth_e.rs index 7dd2d60..3a5fd49 100644 --- a/client/src/functions/modes/edit/auth_e.rs +++ b/client/src/functions/modes/edit/auth_e.rs @@ -62,9 +62,6 @@ pub async fn execute_edit_action( key: KeyEvent, state: &mut S, ideal_cursor_column: &mut usize, - grpc_client: &mut GrpcClient, - current_position: &mut u64, - total_count: u64, ) -> Result> { match action { "insert_char" => { @@ -120,7 +117,7 @@ pub async fn execute_edit_action( let num_fields = state.fields().len(); if num_fields > 0 { let current_field = state.current_field(); - let new_field = (current_field + 1) % num_fields; + let new_field = (current_field + 1).min(num_fields - 1); state.set_current_field(new_field); let current_input = state.get_current_input(); let max_pos = current_input.len(); @@ -135,11 +132,7 @@ pub async fn execute_edit_action( let num_fields = state.fields().len(); if num_fields > 0 { let current_field = state.current_field(); - let new_field = if current_field == 0 { - num_fields - 1 - } else { - current_field - 1 - }; + let new_field = current_field.saturating_sub(1); state.set_current_field(new_field); let current_input = state.get_current_input(); let max_pos = current_input.len(); diff --git a/client/src/functions/modes/edit/form_e.rs b/client/src/functions/modes/edit/form_e.rs index 23d7cf7..8c5bb2c 100644 --- a/client/src/functions/modes/edit/form_e.rs +++ b/client/src/functions/modes/edit/form_e.rs @@ -76,9 +76,6 @@ pub async fn execute_edit_action( key: KeyEvent, state: &mut S, ideal_cursor_column: &mut usize, - grpc_client: &mut GrpcClient, - current_position: &mut u64, - total_count: u64, ) -> Result> { match action { "insert_char" => { diff --git a/client/src/functions/modes/navigation/add_table_nav.rs b/client/src/functions/modes/navigation/add_table_nav.rs index ae758ba..cf3b911 100644 --- a/client/src/functions/modes/navigation/add_table_nav.rs +++ b/client/src/functions/modes/navigation/add_table_nav.rs @@ -23,20 +23,6 @@ pub fn handle_add_table_navigation( let mut handled = true; // Assume handled unless logic determines otherwise let mut new_focus = current_focus; // Initialize new_focus - // Define focus groups for horizontal navigation - let is_left_pane_block_focus = matches!(current_focus, // Focus on the table blocks - AddTableFocus::ColumnsTable | AddTableFocus::IndexesTable | AddTableFocus::LinksTable - ); - let is_inside_table_focus = matches!(current_focus, // Focus inside for scrolling - AddTableFocus::InsideColumnsTable | AddTableFocus::InsideIndexesTable | AddTableFocus::InsideLinksTable - ); - let is_right_pane_general_focus = matches!(current_focus, // Non-canvas elements in right pane - AddTableFocus::AddColumnButton | AddTableFocus::SaveButton | AddTableFocus::DeleteSelectedButton | AddTableFocus::CancelButton - ); - let is_canvas_input_focus = matches!(current_focus, - AddTableFocus::InputTableName | AddTableFocus::InputColumnName | AddTableFocus::InputColumnType - ); - match action.as_deref() { // --- Handle Exiting Table Scroll Mode --- Some("exit_table_scroll") => { diff --git a/client/src/functions/modes/read_only/auth_ro.rs b/client/src/functions/modes/read_only/auth_ro.rs index 6ed2790..25c55e1 100644 --- a/client/src/functions/modes/read_only/auth_ro.rs +++ b/client/src/functions/modes/read_only/auth_ro.rs @@ -252,28 +252,6 @@ fn find_next_word_start(text: &str, current_pos: usize) -> usize { pos } -fn find_next_word_end(text: &str, current_pos: usize) -> usize { - let chars: Vec = text.chars().collect(); - if chars.is_empty() { - return 0; - } - - let next_start = find_next_word_start(text, current_pos); - - if next_start >= chars.len() { - return chars.len().saturating_sub(1); - } - - let mut pos = next_start; - let word_type = get_char_type(chars[pos]); - - while pos < chars.len() && get_char_type(chars[pos]) == word_type { - pos += 1; - } - - pos.saturating_sub(1).min(chars.len().saturating_sub(1)) -} - fn find_word_end(text: &str, current_pos: usize) -> usize { let chars: Vec = text.chars().collect(); let len = chars.len(); @@ -282,8 +260,6 @@ fn find_word_end(text: &str, current_pos: usize) -> usize { } let mut pos = current_pos.min(len - 1); - let original_pos = pos; - let current_type = get_char_type(chars[pos]); if current_type != CharType::Whitespace { while pos < len && get_char_type(chars[pos]) == current_type { diff --git a/client/src/functions/modes/read_only/form_ro.rs b/client/src/functions/modes/read_only/form_ro.rs index cb237ae..470fec2 100644 --- a/client/src/functions/modes/read_only/form_ro.rs +++ b/client/src/functions/modes/read_only/form_ro.rs @@ -238,28 +238,6 @@ fn find_next_word_start(text: &str, current_pos: usize) -> usize { pos } -fn find_next_word_end(text: &str, current_pos: usize) -> usize { - let chars: Vec = text.chars().collect(); - if chars.is_empty() { - return 0; - } - - let next_start = find_next_word_start(text, current_pos); - - if next_start >= chars.len() { - return chars.len().saturating_sub(1); - } - - let mut pos = next_start; - let word_type = get_char_type(chars[pos]); - - while pos < chars.len() && get_char_type(chars[pos]) == word_type { - pos += 1; - } - - pos.saturating_sub(1).min(chars.len().saturating_sub(1)) -} - fn find_word_end(text: &str, current_pos: usize) -> usize { let chars: Vec = text.chars().collect(); let len = chars.len(); @@ -268,8 +246,6 @@ fn find_word_end(text: &str, current_pos: usize) -> usize { } let mut pos = current_pos.min(len - 1); - let original_pos = pos; - let current_type = get_char_type(chars[pos]); if current_type != CharType::Whitespace { while pos < len && get_char_type(chars[pos]) == current_type { diff --git a/client/src/modes/canvas/edit.rs b/client/src/modes/canvas/edit.rs index 0b1d8a1..1cb1476 100644 --- a/client/src/modes/canvas/edit.rs +++ b/client/src/modes/canvas/edit.rs @@ -114,9 +114,6 @@ pub async fn handle_edit_event( key, login_state, ideal_cursor_column, - grpc_client, - current_position, - total_count, ) .await? } else if app_state.ui.show_add_table { @@ -133,9 +130,6 @@ pub async fn handle_edit_event( key, register_state, ideal_cursor_column, - grpc_client, - current_position, - total_count, ) .await? } else { @@ -144,9 +138,6 @@ pub async fn handle_edit_event( key, form_state, ideal_cursor_column, - grpc_client, - current_position, - total_count, ) .await? }; @@ -160,9 +151,6 @@ pub async fn handle_edit_event( key, register_state, ideal_cursor_column, - grpc_client, - current_position, - total_count, ) .await?; return Ok(EditEventOutcome::Message(msg)); @@ -201,9 +189,6 @@ pub async fn handle_edit_event( key, register_state, ideal_cursor_column, - grpc_client, - current_position, - total_count, ) .await?; return Ok(EditEventOutcome::Message(msg)); @@ -217,9 +202,6 @@ pub async fn handle_edit_event( key, login_state, ideal_cursor_column, - grpc_client, - current_position, - total_count, ) .await? } else if app_state.ui.show_add_table { @@ -236,9 +218,6 @@ pub async fn handle_edit_event( key, register_state, ideal_cursor_column, - grpc_client, - current_position, - total_count, ) .await? } else { @@ -247,9 +226,6 @@ pub async fn handle_edit_event( key, form_state, ideal_cursor_column, - grpc_client, - current_position, - total_count, ) .await? }; @@ -269,9 +245,6 @@ pub async fn handle_edit_event( key, login_state, ideal_cursor_column, - grpc_client, - current_position, - total_count, ) .await? } else if app_state.ui.show_add_table { @@ -288,9 +261,6 @@ pub async fn handle_edit_event( key, register_state, ideal_cursor_column, - grpc_client, - current_position, - total_count, ) .await? } else { @@ -299,9 +269,6 @@ pub async fn handle_edit_event( key, form_state, ideal_cursor_column, - grpc_client, - current_position, - total_count, ) .await? }; diff --git a/client/src/services/ui_service.rs b/client/src/services/ui_service.rs index 707f7e4..375e669 100644 --- a/client/src/services/ui_service.rs +++ b/client/src/services/ui_service.rs @@ -50,7 +50,7 @@ impl UiService { pub async fn load_adresar_by_position( grpc_client: &mut GrpcClient, - app_state: &mut AppState, + _app_state: &mut AppState, form_state: &mut FormState, position: u64, ) -> Result> {