warnings fixed
This commit is contained in:
@@ -249,7 +249,6 @@ pub fn render_add_table(
|
|||||||
.iter()
|
.iter()
|
||||||
.map(|h| Cell::from(*h).style(Style::default().fg(theme.accent)));
|
.map(|h| Cell::from(*h).style(Style::default().fg(theme.accent)));
|
||||||
let header = Row::new(header_cells).height(1).bottom_margin(1);
|
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(
|
let columns_table = Table::new(
|
||||||
column_rows,
|
column_rows,
|
||||||
[ // Define constraints for 3 columns: Sel, Name, Type
|
[ // Define constraints for 3 columns: Sel, Name, Type
|
||||||
@@ -353,7 +352,6 @@ pub fn render_add_table(
|
|||||||
.iter()
|
.iter()
|
||||||
.map(|h| Cell::from(*h).style(Style::default().fg(theme.accent)));
|
.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 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 =
|
let indexes_table =
|
||||||
Table::new(index_rows, [Constraint::Percentage(100)])
|
Table::new(index_rows, [Constraint::Percentage(100)])
|
||||||
.header(index_header)
|
.header(index_header)
|
||||||
@@ -399,7 +397,6 @@ pub fn render_add_table(
|
|||||||
.iter()
|
.iter()
|
||||||
.map(|h| Cell::from(*h).style(Style::default().fg(theme.accent)));
|
.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 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 =
|
let links_table =
|
||||||
Table::new(link_rows, [Constraint::Percentage(80), Constraint::Min(5)])
|
Table::new(link_rows, [Constraint::Percentage(80), Constraint::Min(5)])
|
||||||
.header(link_header)
|
.header(link_header)
|
||||||
|
|||||||
@@ -66,8 +66,7 @@ pub fn render_admin_panel_admin(
|
|||||||
.enumerate()
|
.enumerate()
|
||||||
.map(|(idx, profile)| {
|
.map(|(idx, profile)| {
|
||||||
// Check persistent selection for prefix, navigation state for style/highlight
|
// 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_selected = admin_state.selected_profile_index == Some(idx);
|
||||||
let is_navigated = admin_state.profile_list_state.selected() == Some(idx); // Use nav state for highlight/>
|
|
||||||
let prefix = if is_selected { "[*] " } else { "[ ] " };
|
let prefix = if is_selected { "[*] " } else { "[ ] " };
|
||||||
let style = if is_selected { // Style based on selection too
|
let style = if is_selected { // Style based on selection too
|
||||||
Style::default().fg(theme.highlight).add_modifier(ratatui::style::Modifier::BOLD)
|
Style::default().fg(theme.highlight).add_modifier(ratatui::style::Modifier::BOLD)
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ pub fn render_register(
|
|||||||
let selected = state.get_selected_suggestion_index();
|
let selected = state.get_selected_suggestion_index();
|
||||||
if !suggestions.is_empty() {
|
if !suggestions.is_empty() {
|
||||||
if let Some(input_rect) = active_field_rect {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use crate::config::colors::themes::Theme;
|
|||||||
use crate::state::app::buffer::BufferState;
|
use crate::state::app::buffer::BufferState;
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
layout::{Alignment, Rect},
|
layout::{Alignment, Rect},
|
||||||
style::{Style, Stylize},
|
style::Style,
|
||||||
text::{Line, Span},
|
text::{Line, Span},
|
||||||
widgets::Paragraph,
|
widgets::Paragraph,
|
||||||
Frame,
|
Frame,
|
||||||
|
|||||||
@@ -62,9 +62,6 @@ pub async fn execute_edit_action<S: CanvasState + Any + Send>(
|
|||||||
key: KeyEvent,
|
key: KeyEvent,
|
||||||
state: &mut S,
|
state: &mut S,
|
||||||
ideal_cursor_column: &mut usize,
|
ideal_cursor_column: &mut usize,
|
||||||
grpc_client: &mut GrpcClient,
|
|
||||||
current_position: &mut u64,
|
|
||||||
total_count: u64,
|
|
||||||
) -> Result<String, Box<dyn std::error::Error>> {
|
) -> Result<String, Box<dyn std::error::Error>> {
|
||||||
match action {
|
match action {
|
||||||
"insert_char" => {
|
"insert_char" => {
|
||||||
@@ -120,7 +117,7 @@ pub async fn execute_edit_action<S: CanvasState + Any + Send>(
|
|||||||
let num_fields = state.fields().len();
|
let num_fields = state.fields().len();
|
||||||
if num_fields > 0 {
|
if num_fields > 0 {
|
||||||
let current_field = state.current_field();
|
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);
|
state.set_current_field(new_field);
|
||||||
let current_input = state.get_current_input();
|
let current_input = state.get_current_input();
|
||||||
let max_pos = current_input.len();
|
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();
|
let num_fields = state.fields().len();
|
||||||
if num_fields > 0 {
|
if num_fields > 0 {
|
||||||
let current_field = state.current_field();
|
let current_field = state.current_field();
|
||||||
let new_field = if current_field == 0 {
|
let new_field = current_field.saturating_sub(1);
|
||||||
num_fields - 1
|
|
||||||
} else {
|
|
||||||
current_field - 1
|
|
||||||
};
|
|
||||||
state.set_current_field(new_field);
|
state.set_current_field(new_field);
|
||||||
let current_input = state.get_current_input();
|
let current_input = state.get_current_input();
|
||||||
let max_pos = current_input.len();
|
let max_pos = current_input.len();
|
||||||
|
|||||||
@@ -76,9 +76,6 @@ pub async fn execute_edit_action<S: CanvasState>(
|
|||||||
key: KeyEvent,
|
key: KeyEvent,
|
||||||
state: &mut S,
|
state: &mut S,
|
||||||
ideal_cursor_column: &mut usize,
|
ideal_cursor_column: &mut usize,
|
||||||
grpc_client: &mut GrpcClient,
|
|
||||||
current_position: &mut u64,
|
|
||||||
total_count: u64,
|
|
||||||
) -> Result<String, Box<dyn std::error::Error>> {
|
) -> Result<String, Box<dyn std::error::Error>> {
|
||||||
match action {
|
match action {
|
||||||
"insert_char" => {
|
"insert_char" => {
|
||||||
|
|||||||
@@ -23,20 +23,6 @@ pub fn handle_add_table_navigation(
|
|||||||
let mut handled = true; // Assume handled unless logic determines otherwise
|
let mut handled = true; // Assume handled unless logic determines otherwise
|
||||||
let mut new_focus = current_focus; // Initialize new_focus
|
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() {
|
match action.as_deref() {
|
||||||
// --- Handle Exiting Table Scroll Mode ---
|
// --- Handle Exiting Table Scroll Mode ---
|
||||||
Some("exit_table_scroll") => {
|
Some("exit_table_scroll") => {
|
||||||
|
|||||||
@@ -252,28 +252,6 @@ fn find_next_word_start(text: &str, current_pos: usize) -> usize {
|
|||||||
pos
|
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 {
|
fn find_word_end(text: &str, current_pos: usize) -> usize {
|
||||||
let chars: Vec<char> = text.chars().collect();
|
let chars: Vec<char> = text.chars().collect();
|
||||||
let len = chars.len();
|
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 mut pos = current_pos.min(len - 1);
|
||||||
let original_pos = pos;
|
|
||||||
|
|
||||||
let current_type = get_char_type(chars[pos]);
|
let current_type = get_char_type(chars[pos]);
|
||||||
if current_type != CharType::Whitespace {
|
if current_type != CharType::Whitespace {
|
||||||
while pos < len && get_char_type(chars[pos]) == current_type {
|
while pos < len && get_char_type(chars[pos]) == current_type {
|
||||||
|
|||||||
@@ -238,28 +238,6 @@ fn find_next_word_start(text: &str, current_pos: usize) -> usize {
|
|||||||
pos
|
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 {
|
fn find_word_end(text: &str, current_pos: usize) -> usize {
|
||||||
let chars: Vec<char> = text.chars().collect();
|
let chars: Vec<char> = text.chars().collect();
|
||||||
let len = chars.len();
|
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 mut pos = current_pos.min(len - 1);
|
||||||
let original_pos = pos;
|
|
||||||
|
|
||||||
let current_type = get_char_type(chars[pos]);
|
let current_type = get_char_type(chars[pos]);
|
||||||
if current_type != CharType::Whitespace {
|
if current_type != CharType::Whitespace {
|
||||||
while pos < len && get_char_type(chars[pos]) == current_type {
|
while pos < len && get_char_type(chars[pos]) == current_type {
|
||||||
|
|||||||
@@ -114,9 +114,6 @@ pub async fn handle_edit_event(
|
|||||||
key,
|
key,
|
||||||
login_state,
|
login_state,
|
||||||
ideal_cursor_column,
|
ideal_cursor_column,
|
||||||
grpc_client,
|
|
||||||
current_position,
|
|
||||||
total_count,
|
|
||||||
)
|
)
|
||||||
.await?
|
.await?
|
||||||
} else if app_state.ui.show_add_table {
|
} else if app_state.ui.show_add_table {
|
||||||
@@ -133,9 +130,6 @@ pub async fn handle_edit_event(
|
|||||||
key,
|
key,
|
||||||
register_state,
|
register_state,
|
||||||
ideal_cursor_column,
|
ideal_cursor_column,
|
||||||
grpc_client,
|
|
||||||
current_position,
|
|
||||||
total_count,
|
|
||||||
)
|
)
|
||||||
.await?
|
.await?
|
||||||
} else {
|
} else {
|
||||||
@@ -144,9 +138,6 @@ pub async fn handle_edit_event(
|
|||||||
key,
|
key,
|
||||||
form_state,
|
form_state,
|
||||||
ideal_cursor_column,
|
ideal_cursor_column,
|
||||||
grpc_client,
|
|
||||||
current_position,
|
|
||||||
total_count,
|
|
||||||
)
|
)
|
||||||
.await?
|
.await?
|
||||||
};
|
};
|
||||||
@@ -160,9 +151,6 @@ pub async fn handle_edit_event(
|
|||||||
key,
|
key,
|
||||||
register_state,
|
register_state,
|
||||||
ideal_cursor_column,
|
ideal_cursor_column,
|
||||||
grpc_client,
|
|
||||||
current_position,
|
|
||||||
total_count,
|
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
return Ok(EditEventOutcome::Message(msg));
|
return Ok(EditEventOutcome::Message(msg));
|
||||||
@@ -201,9 +189,6 @@ pub async fn handle_edit_event(
|
|||||||
key,
|
key,
|
||||||
register_state,
|
register_state,
|
||||||
ideal_cursor_column,
|
ideal_cursor_column,
|
||||||
grpc_client,
|
|
||||||
current_position,
|
|
||||||
total_count,
|
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
return Ok(EditEventOutcome::Message(msg));
|
return Ok(EditEventOutcome::Message(msg));
|
||||||
@@ -217,9 +202,6 @@ pub async fn handle_edit_event(
|
|||||||
key,
|
key,
|
||||||
login_state,
|
login_state,
|
||||||
ideal_cursor_column,
|
ideal_cursor_column,
|
||||||
grpc_client,
|
|
||||||
current_position,
|
|
||||||
total_count,
|
|
||||||
)
|
)
|
||||||
.await?
|
.await?
|
||||||
} else if app_state.ui.show_add_table {
|
} else if app_state.ui.show_add_table {
|
||||||
@@ -236,9 +218,6 @@ pub async fn handle_edit_event(
|
|||||||
key,
|
key,
|
||||||
register_state,
|
register_state,
|
||||||
ideal_cursor_column,
|
ideal_cursor_column,
|
||||||
grpc_client,
|
|
||||||
current_position,
|
|
||||||
total_count,
|
|
||||||
)
|
)
|
||||||
.await?
|
.await?
|
||||||
} else {
|
} else {
|
||||||
@@ -247,9 +226,6 @@ pub async fn handle_edit_event(
|
|||||||
key,
|
key,
|
||||||
form_state,
|
form_state,
|
||||||
ideal_cursor_column,
|
ideal_cursor_column,
|
||||||
grpc_client,
|
|
||||||
current_position,
|
|
||||||
total_count,
|
|
||||||
)
|
)
|
||||||
.await?
|
.await?
|
||||||
};
|
};
|
||||||
@@ -269,9 +245,6 @@ pub async fn handle_edit_event(
|
|||||||
key,
|
key,
|
||||||
login_state,
|
login_state,
|
||||||
ideal_cursor_column,
|
ideal_cursor_column,
|
||||||
grpc_client,
|
|
||||||
current_position,
|
|
||||||
total_count,
|
|
||||||
)
|
)
|
||||||
.await?
|
.await?
|
||||||
} else if app_state.ui.show_add_table {
|
} else if app_state.ui.show_add_table {
|
||||||
@@ -288,9 +261,6 @@ pub async fn handle_edit_event(
|
|||||||
key,
|
key,
|
||||||
register_state,
|
register_state,
|
||||||
ideal_cursor_column,
|
ideal_cursor_column,
|
||||||
grpc_client,
|
|
||||||
current_position,
|
|
||||||
total_count,
|
|
||||||
)
|
)
|
||||||
.await?
|
.await?
|
||||||
} else {
|
} else {
|
||||||
@@ -299,9 +269,6 @@ pub async fn handle_edit_event(
|
|||||||
key,
|
key,
|
||||||
form_state,
|
form_state,
|
||||||
ideal_cursor_column,
|
ideal_cursor_column,
|
||||||
grpc_client,
|
|
||||||
current_position,
|
|
||||||
total_count,
|
|
||||||
)
|
)
|
||||||
.await?
|
.await?
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ impl UiService {
|
|||||||
|
|
||||||
pub async fn load_adresar_by_position(
|
pub async fn load_adresar_by_position(
|
||||||
grpc_client: &mut GrpcClient,
|
grpc_client: &mut GrpcClient,
|
||||||
app_state: &mut AppState,
|
_app_state: &mut AppState,
|
||||||
form_state: &mut FormState,
|
form_state: &mut FormState,
|
||||||
position: u64,
|
position: u64,
|
||||||
) -> Result<String, Box<dyn std::error::Error>> {
|
) -> Result<String, Box<dyn std::error::Error>> {
|
||||||
|
|||||||
Reference in New Issue
Block a user