removed silenced variables
This commit is contained in:
@@ -114,7 +114,7 @@ async fn state_machine_example() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_feature_action(&mut self, action: &CanvasAction, _context: &ActionContext) -> Option<String> {
|
fn handle_feature_action(&mut self, action: &CanvasAction, context: &ActionContext) -> Option<String> {
|
||||||
match action {
|
match action {
|
||||||
CanvasAction::Custom(cmd) => match cmd.as_str() {
|
CanvasAction::Custom(cmd) => match cmd.as_str() {
|
||||||
"submit" => {
|
"submit" => {
|
||||||
@@ -147,7 +147,7 @@ async fn state_machine_example() {
|
|||||||
println!(" Initial state: {:?}", form.state);
|
println!(" Initial state: {:?}", form.state);
|
||||||
|
|
||||||
// Type some text to trigger state change
|
// Type some text to trigger state change
|
||||||
let _result = ActionDispatcher::dispatch(
|
let result = ActionDispatcher::dispatch(
|
||||||
CanvasAction::InsertChar('u'),
|
CanvasAction::InsertChar('u'),
|
||||||
&mut form,
|
&mut form,
|
||||||
&mut ideal_cursor,
|
&mut ideal_cursor,
|
||||||
@@ -231,7 +231,7 @@ async fn event_driven_example() {
|
|||||||
self.has_changes = changed;
|
self.has_changes = changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_feature_action(&mut self, action: &CanvasAction, _context: &ActionContext) -> Option<String> {
|
fn handle_feature_action(&mut self, action: &CanvasAction, context: &ActionContext) -> Option<String> {
|
||||||
match action {
|
match action {
|
||||||
CanvasAction::Custom(cmd) => match cmd.as_str() {
|
CanvasAction::Custom(cmd) => match cmd.as_str() {
|
||||||
"validate" => {
|
"validate" => {
|
||||||
@@ -384,7 +384,7 @@ async fn validation_pipeline_example() {
|
|||||||
fn has_unsaved_changes(&self) -> bool { self.has_changes }
|
fn has_unsaved_changes(&self) -> bool { self.has_changes }
|
||||||
fn set_has_unsaved_changes(&mut self, changed: bool) { self.has_changes = changed; }
|
fn set_has_unsaved_changes(&mut self, changed: bool) { self.has_changes = changed; }
|
||||||
|
|
||||||
fn handle_feature_action(&mut self, action: &CanvasAction, _context: &ActionContext) -> Option<String> {
|
fn handle_feature_action(&mut self, action: &CanvasAction, context: &ActionContext) -> Option<String> {
|
||||||
match action {
|
match action {
|
||||||
CanvasAction::Custom(cmd) => match cmd.as_str() {
|
CanvasAction::Custom(cmd) => match cmd.as_str() {
|
||||||
"validate" => {
|
"validate" => {
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ where
|
|||||||
{
|
{
|
||||||
let mut active_field_input_rect = None;
|
let mut active_field_input_rect = None;
|
||||||
|
|
||||||
for (i, _input) in inputs.iter().enumerate() {
|
for (i, input) in inputs.iter().enumerate() {
|
||||||
let is_active = i == *current_field_idx;
|
let is_active = i == *current_field_idx;
|
||||||
let typed_text = get_display_value(i);
|
let typed_text = get_display_value(i);
|
||||||
|
|
||||||
@@ -323,7 +323,7 @@ fn apply_highlighting<'a, T: CanvasTheme>(
|
|||||||
current_cursor_pos: usize,
|
current_cursor_pos: usize,
|
||||||
highlight_state: &HighlightState,
|
highlight_state: &HighlightState,
|
||||||
theme: &T,
|
theme: &T,
|
||||||
_is_active: bool,
|
is_active: bool,
|
||||||
) -> Line<'a> {
|
) -> Line<'a> {
|
||||||
let text_len = text.chars().count();
|
let text_len = text.chars().count();
|
||||||
|
|
||||||
@@ -335,10 +335,10 @@ fn apply_highlighting<'a, T: CanvasTheme>(
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
HighlightState::Characterwise { anchor } => {
|
HighlightState::Characterwise { anchor } => {
|
||||||
apply_characterwise_highlighting(text, text_len, field_index, current_field_idx, current_cursor_pos, anchor, theme, _is_active)
|
apply_characterwise_highlighting(text, text_len, field_index, current_field_idx, current_cursor_pos, anchor, theme, is_active)
|
||||||
}
|
}
|
||||||
HighlightState::Linewise { anchor_line } => {
|
HighlightState::Linewise { anchor_line } => {
|
||||||
apply_linewise_highlighting(text, field_index, current_field_idx, anchor_line, theme, _is_active)
|
apply_linewise_highlighting(text, field_index, current_field_idx, anchor_line, theme, is_active)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -353,7 +353,7 @@ fn apply_characterwise_highlighting<'a, T: CanvasTheme>(
|
|||||||
current_cursor_pos: usize,
|
current_cursor_pos: usize,
|
||||||
anchor: &(usize, usize),
|
anchor: &(usize, usize),
|
||||||
theme: &T,
|
theme: &T,
|
||||||
_is_active: bool,
|
is_active: bool,
|
||||||
) -> Line<'a> {
|
) -> Line<'a> {
|
||||||
let (anchor_field, anchor_char) = *anchor;
|
let (anchor_field, anchor_char) = *anchor;
|
||||||
let start_field = min(anchor_field, *current_field_idx);
|
let start_field = min(anchor_field, *current_field_idx);
|
||||||
@@ -456,7 +456,7 @@ fn apply_linewise_highlighting<'a, T: CanvasTheme>(
|
|||||||
current_field_idx: &usize,
|
current_field_idx: &usize,
|
||||||
anchor_line: &usize,
|
anchor_line: &usize,
|
||||||
theme: &T,
|
theme: &T,
|
||||||
_is_active: bool,
|
is_active: bool,
|
||||||
) -> Line<'a> {
|
) -> Line<'a> {
|
||||||
let start_field = min(*anchor_line, *current_field_idx);
|
let start_field = min(*anchor_line, *current_field_idx);
|
||||||
let end_field = max(*anchor_line, *current_field_idx);
|
let end_field = max(*anchor_line, *current_field_idx);
|
||||||
@@ -487,7 +487,7 @@ fn set_cursor_position(
|
|||||||
field_rect: Rect,
|
field_rect: Rect,
|
||||||
text: &str,
|
text: &str,
|
||||||
current_cursor_pos: usize,
|
current_cursor_pos: usize,
|
||||||
_has_display_override: bool,
|
has_display_override: bool,
|
||||||
) {
|
) {
|
||||||
// Sum display widths of the first current_cursor_pos characters
|
// Sum display widths of the first current_cursor_pos characters
|
||||||
let mut cols: u16 = 0;
|
let mut cols: u16 = 0;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ pub trait ComputedProvider {
|
|||||||
/// Get list of field dependencies for optimization.
|
/// Get list of field dependencies for optimization.
|
||||||
/// If field A depends on fields [1, 3], only recompute A when fields 1 or 3 change.
|
/// If field A depends on fields [1, 3], only recompute A when fields 1 or 3 change.
|
||||||
/// Default: depend on all fields (always recompute) with a reasonable upper bound.
|
/// Default: depend on all fields (always recompute) with a reasonable upper bound.
|
||||||
fn field_dependencies(&self, _field_index: usize) -> Vec<usize> {
|
fn field_dependencies(&self, field_index: usize) -> Vec<usize> {
|
||||||
(0..100).collect()
|
(0..100).collect()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -19,33 +19,33 @@ pub trait DataProvider {
|
|||||||
fn set_field_value(&mut self, index: usize, value: String);
|
fn set_field_value(&mut self, index: usize, value: String);
|
||||||
|
|
||||||
/// Check if field supports suggestions (optional)
|
/// Check if field supports suggestions (optional)
|
||||||
fn supports_suggestions(&self, _field_index: usize) -> bool {
|
fn supports_suggestions(&self, field_index: usize) -> bool {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get display value (for password masking, etc.) - optional
|
/// Get display value (for password masking, etc.) - optional
|
||||||
fn display_value(&self, _index: usize) -> Option<&str> {
|
fn display_value(&self, index: usize) -> Option<&str> {
|
||||||
None // Default: use actual value
|
None // Default: use actual value
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get validation configuration for a field (optional)
|
/// Get validation configuration for a field (optional)
|
||||||
/// Only available when the 'validation' feature is enabled
|
/// Only available when the 'validation' feature is enabled
|
||||||
#[cfg(feature = "validation")]
|
#[cfg(feature = "validation")]
|
||||||
fn validation_config(&self, _field_index: usize) -> Option<crate::validation::ValidationConfig> {
|
fn validation_config(&self, field_index: usize) -> Option<crate::validation::ValidationConfig> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check if field is computed (display-only, skip in navigation)
|
/// Check if field is computed (display-only, skip in navigation)
|
||||||
/// Default: not computed
|
/// Default: not computed
|
||||||
#[cfg(feature = "computed")]
|
#[cfg(feature = "computed")]
|
||||||
fn is_computed_field(&self, _field_index: usize) -> bool {
|
fn is_computed_field(&self, field_index: usize) -> bool {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get computed field value if this is a computed field.
|
/// Get computed field value if this is a computed field.
|
||||||
/// Returns None for regular fields. Default: not computed.
|
/// Returns None for regular fields. Default: not computed.
|
||||||
#[cfg(feature = "computed")]
|
#[cfg(feature = "computed")]
|
||||||
fn computed_field_value(&self, _field_index: usize) -> Option<String> {
|
fn computed_field_value(&self, field_index: usize) -> Option<String> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,10 @@ use crate::canvas::CursorManager;
|
|||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use crate::canvas::state::EditorState;
|
use crate::canvas::state::EditorState;
|
||||||
use crate::data_provider::{DataProvider, SuggestionsProvider, SuggestionItem};
|
use crate::{DataProvider, SuggestionItem};
|
||||||
|
#[cfg(feature = "suggestions")]
|
||||||
|
use crate::SuggestionsProvider;
|
||||||
|
|
||||||
use crate::canvas::modes::AppMode;
|
use crate::canvas::modes::AppMode;
|
||||||
use crate::canvas::state::SelectionState;
|
use crate::canvas::state::SelectionState;
|
||||||
|
|
||||||
@@ -157,7 +160,7 @@ impl<D: DataProvider> FormEditor<D> {
|
|||||||
if matches!(self.ui_state.current_mode, AppMode::Edit) {
|
if matches!(self.ui_state.current_mode, AppMode::Edit) {
|
||||||
return raw.to_string();
|
return raw.to_string();
|
||||||
}
|
}
|
||||||
if let Some((formatted, _mapper, _warning)) = cfg.run_custom_formatter(raw) {
|
if let Some((formatted, mapper, warning)) = cfg.run_custom_formatter(raw) {
|
||||||
return formatted;
|
return formatted;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -254,7 +257,7 @@ impl<D: DataProvider> FormEditor<D> {
|
|||||||
return raw.to_string();
|
return raw.to_string();
|
||||||
}
|
}
|
||||||
// Not editing -> formatted
|
// Not editing -> formatted
|
||||||
if let Some((formatted, _mapper, _warning)) = cfg.run_custom_formatter(raw) {
|
if let Some((formatted, mapper, warning)) = cfg.run_custom_formatter(raw) {
|
||||||
return formatted;
|
return formatted;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -768,7 +771,7 @@ impl<D: DataProvider> FormEditor<D> {
|
|||||||
pub fn current_formatter_warning(&self) -> Option<String> {
|
pub fn current_formatter_warning(&self) -> Option<String> {
|
||||||
let idx = self.ui_state.current_field;
|
let idx = self.ui_state.current_field;
|
||||||
if let Some(cfg) = self.ui_state.validation.get_field_config(idx) {
|
if let Some(cfg) = self.ui_state.validation.get_field_config(idx) {
|
||||||
if let Some((_fmt, _mapper, warn)) = cfg.run_custom_formatter(self.current_text()) {
|
if let Some((fmt, mapper, warn)) = cfg.run_custom_formatter(self.current_text()) {
|
||||||
return warn;
|
return warn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -929,7 +932,7 @@ impl<D: DataProvider> FormEditor<D> {
|
|||||||
// Validate the new content if validation is enabled
|
// Validate the new content if validation is enabled
|
||||||
#[cfg(feature = "validation")]
|
#[cfg(feature = "validation")]
|
||||||
{
|
{
|
||||||
let _validation_result = self.ui_state.validation.validate_field_content(
|
let validation_result = self.ui_state.validation.validate_field_content(
|
||||||
field_index,
|
field_index,
|
||||||
&suggestion.value_to_store,
|
&suggestion.value_to_store,
|
||||||
);
|
);
|
||||||
@@ -1373,7 +1376,7 @@ impl<D: DataProvider> FormEditor<D> {
|
|||||||
// Validate the new content if validation is enabled
|
// Validate the new content if validation is enabled
|
||||||
#[cfg(feature = "validation")]
|
#[cfg(feature = "validation")]
|
||||||
{
|
{
|
||||||
let _validation_result = self.ui_state.validation.validate_field_content(
|
let validation_result = self.ui_state.validation.validate_field_content(
|
||||||
field_index,
|
field_index,
|
||||||
&value,
|
&value,
|
||||||
);
|
);
|
||||||
@@ -1393,7 +1396,7 @@ impl<D: DataProvider> FormEditor<D> {
|
|||||||
// Validate the new content if validation is enabled
|
// Validate the new content if validation is enabled
|
||||||
#[cfg(feature = "validation")]
|
#[cfg(feature = "validation")]
|
||||||
{
|
{
|
||||||
let _validation_result = self.ui_state.validation.validate_field_content(
|
let validation_result = self.ui_state.validation.validate_field_content(
|
||||||
field_index,
|
field_index,
|
||||||
&value,
|
&value,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ impl CharacterLimits {
|
|||||||
pub fn validate_insertion(
|
pub fn validate_insertion(
|
||||||
&self,
|
&self,
|
||||||
current_text: &str,
|
current_text: &str,
|
||||||
_position: usize,
|
position: usize,
|
||||||
character: char,
|
character: char,
|
||||||
) -> Option<ValidationResult> {
|
) -> Option<ValidationResult> {
|
||||||
let current_count = self.count(current_text);
|
let current_count = self.count(current_text);
|
||||||
|
|||||||
Reference in New Issue
Block a user