warnings fixed

This commit is contained in:
filipriec
2025-04-18 16:17:02 +02:00
parent 6010b9a0af
commit 2a1fafc3f9
11 changed files with 6 additions and 115 deletions

View File

@@ -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)

View File

@@ -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)

View File

@@ -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);
}
}
}

View File

@@ -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,

View File

@@ -62,9 +62,6 @@ pub async fn execute_edit_action<S: CanvasState + Any + Send>(
key: KeyEvent,
state: &mut S,
ideal_cursor_column: &mut usize,
grpc_client: &mut GrpcClient,
current_position: &mut u64,
total_count: u64,
) -> Result<String, Box<dyn std::error::Error>> {
match action {
"insert_char" => {
@@ -120,7 +117,7 @@ pub async fn execute_edit_action<S: CanvasState + Any + Send>(
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<S: CanvasState + Any + Send>(
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();

View File

@@ -76,9 +76,6 @@ pub async fn execute_edit_action<S: CanvasState>(
key: KeyEvent,
state: &mut S,
ideal_cursor_column: &mut usize,
grpc_client: &mut GrpcClient,
current_position: &mut u64,
total_count: u64,
) -> Result<String, Box<dyn std::error::Error>> {
match action {
"insert_char" => {

View File

@@ -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") => {

View File

@@ -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<char> = 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<char> = 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 {

View File

@@ -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<char> = 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<char> = 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 {

View File

@@ -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?
};

View File

@@ -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<String, Box<dyn std::error::Error>> {