renamed capital lettered functions and fixed examples
This commit is contained in:
@@ -324,23 +324,23 @@ impl<D: DataProvider> AutoCursorFormEditor<D> {
|
||||
result
|
||||
}
|
||||
|
||||
fn move_WORD_next(&mut self) {
|
||||
self.editor.move_WORD_next();
|
||||
fn move_big_word_next(&mut self) {
|
||||
self.editor.move_big_word_next();
|
||||
self.update_visual_selection();
|
||||
}
|
||||
|
||||
fn move_WORD_prev(&mut self) {
|
||||
self.editor.move_WORD_prev();
|
||||
fn move_big_word_prev(&mut self) {
|
||||
self.editor.move_big_word_prev();
|
||||
self.update_visual_selection();
|
||||
}
|
||||
|
||||
fn move_WORD_end(&mut self) {
|
||||
self.editor.move_WORD_end();
|
||||
fn move_big_word_end(&mut self) {
|
||||
self.editor.move_big_word_end();
|
||||
self.update_visual_selection();
|
||||
}
|
||||
|
||||
fn move_WORD_end_prev(&mut self) {
|
||||
self.editor.move_WORD_end_prev();
|
||||
fn move_big_word_end_prev(&mut self) {
|
||||
self.editor.move_big_word_end_prev();
|
||||
self.update_visual_selection();
|
||||
}
|
||||
}
|
||||
@@ -564,23 +564,23 @@ fn handle_key_press(
|
||||
}
|
||||
|
||||
(AppMode::ReadOnly | AppMode::Highlight, KeyCode::Char('W'), _) => {
|
||||
editor.move_WORD_next();
|
||||
editor.move_big_word_next();
|
||||
editor.set_debug_message("W: next WORD start".to_string());
|
||||
editor.clear_command_buffer();
|
||||
}
|
||||
(AppMode::ReadOnly | AppMode::Highlight, KeyCode::Char('B'), _) => {
|
||||
editor.move_WORD_prev();
|
||||
editor.move_big_word_prev();
|
||||
editor.set_debug_message("B: previous WORD start".to_string());
|
||||
editor.clear_command_buffer();
|
||||
}
|
||||
(AppMode::ReadOnly | AppMode::Highlight, KeyCode::Char('E'), _) => {
|
||||
// Check if this is 'gE' command
|
||||
if editor.get_command_buffer() == "g" {
|
||||
editor.move_WORD_end_prev();
|
||||
editor.move_big_word_end_prev();
|
||||
editor.set_debug_message("gE: previous WORD end".to_string());
|
||||
editor.clear_command_buffer();
|
||||
} else {
|
||||
editor.move_WORD_end();
|
||||
editor.move_big_word_end();
|
||||
editor.set_debug_message("E: WORD end".to_string());
|
||||
editor.clear_command_buffer();
|
||||
}
|
||||
|
||||
@@ -241,20 +241,17 @@ impl<D: DataProvider> ValidationFormEditor<D> {
|
||||
if !self.validation_enabled {
|
||||
return;
|
||||
}
|
||||
if let Some(result) = self.editor.current_field_validation() {
|
||||
match result {
|
||||
ValidationResult::Valid => {
|
||||
self.debug_message = format!("Field {}: ✅ Valid", self.editor.current_field() + 1);
|
||||
}
|
||||
ValidationResult::Warning { message } => {
|
||||
self.debug_message = format!("Field {}: ⚠️ {}", self.editor.current_field() + 1, message);
|
||||
}
|
||||
ValidationResult::Error { message } => {
|
||||
self.debug_message = format!("Field {}: ❌ {}", self.editor.current_field() + 1, message);
|
||||
}
|
||||
let result = self.editor.validate_current_field();
|
||||
match result {
|
||||
ValidationResult::Valid => {
|
||||
self.debug_message = format!("Field {}: ✅ Valid", self.editor.current_field() + 1);
|
||||
}
|
||||
ValidationResult::Warning { message } => {
|
||||
self.debug_message = format!("Field {}: ⚠️ {}", self.editor.current_field() + 1, message);
|
||||
}
|
||||
ValidationResult::Error { message } => {
|
||||
self.debug_message = format!("Field {}: ❌ {}", self.editor.current_field() + 1, message);
|
||||
}
|
||||
} else {
|
||||
self.debug_message = format!("Field {}: 🔍 Not validated yet", self.editor.current_field() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,25 +280,24 @@ impl<D: DataProvider> ValidationFormEditor<D> {
|
||||
if result.is_ok() {
|
||||
self.has_unsaved_changes = true;
|
||||
// Show real-time validation feedback
|
||||
if let Some(validation_result) = self.editor.current_field_validation() {
|
||||
match validation_result {
|
||||
ValidationResult::Valid => {
|
||||
// Don't spam with valid messages, just show character count if applicable
|
||||
if let Some(limits) = self.get_current_field_limits() {
|
||||
let field_index = self.editor.current_field();
|
||||
if let Some(status) = limits.status_text(
|
||||
self.editor.data_provider().field_value(field_index)
|
||||
) {
|
||||
self.debug_message = format!("✏️ {}", status);
|
||||
}
|
||||
let validation_result = self.editor.validate_current_field();
|
||||
match validation_result {
|
||||
ValidationResult::Valid => {
|
||||
// Don't spam with valid messages, just show character count if applicable
|
||||
if let Some(limits) = self.get_current_field_limits() {
|
||||
let field_index = self.editor.current_field();
|
||||
if let Some(status) = limits.status_text(
|
||||
self.editor.data_provider().field_value(field_index)
|
||||
) {
|
||||
self.debug_message = format!("✏️ {}", status);
|
||||
}
|
||||
}
|
||||
ValidationResult::Warning { message } => {
|
||||
self.debug_message = format!("⚠️ {}", message);
|
||||
}
|
||||
ValidationResult::Error { message } => {
|
||||
self.debug_message = format!("❌ {}", message);
|
||||
}
|
||||
}
|
||||
ValidationResult::Warning { message } => {
|
||||
self.debug_message = format!("⚠️ {}", message);
|
||||
}
|
||||
ValidationResult::Error { message } => {
|
||||
self.debug_message = format!("❌ {}", message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,12 +129,11 @@ impl<D: DataProvider> AdvancedPatternFormEditor<D> {
|
||||
fn insert_char(&mut self, ch: char) -> anyhow::Result<()> {
|
||||
let result = self.editor.insert_char(ch);
|
||||
if result.is_ok() {
|
||||
if let Some(validation_result) = self.editor.current_field_validation() {
|
||||
match validation_result {
|
||||
ValidationResult::Valid => { self.debug_message = "✅ Character accepted".to_string(); }
|
||||
ValidationResult::Warning { message } => { self.debug_message = format!("⚠️ Warning: {}", message); }
|
||||
ValidationResult::Error { message } => { self.debug_message = format!("❌ Pattern violation: {}", message); }
|
||||
}
|
||||
let validation_result = self.editor.validate_current_field();
|
||||
match validation_result {
|
||||
ValidationResult::Valid => { self.debug_message = "✅ Character accepted".to_string(); }
|
||||
ValidationResult::Warning { message } => { self.debug_message = format!("⚠️ Warning: {}", message); }
|
||||
ValidationResult::Error { message } => { self.debug_message = format!("❌ Pattern violation: {}", message); }
|
||||
}
|
||||
}
|
||||
Ok(result?)
|
||||
@@ -183,12 +182,11 @@ impl<D: DataProvider> AdvancedPatternFormEditor<D> {
|
||||
|
||||
fn update_field_validation_status(&mut self) {
|
||||
if !self.validation_enabled { return; }
|
||||
if let Some(result) = self.editor.current_field_validation() {
|
||||
match result {
|
||||
ValidationResult::Valid => { self.debug_message = format!("Field {}: ✅ Pattern valid", self.editor.current_field() + 1); }
|
||||
ValidationResult::Warning { message } => { self.debug_message = format!("Field {}: ⚠️ {}", self.editor.current_field() + 1, message); }
|
||||
ValidationResult::Error { message } => { self.debug_message = format!("Field {}: ❌ {}", self.editor.current_field() + 1, message); }
|
||||
}
|
||||
let result = self.editor.validate_current_field();
|
||||
match result {
|
||||
ValidationResult::Valid => { self.debug_message = format!("Field {}: ✅ Pattern valid", self.editor.current_field() + 1); }
|
||||
ValidationResult::Warning { message } => { self.debug_message = format!("Field {}: ⚠️ {}", self.editor.current_field() + 1, message); }
|
||||
ValidationResult::Error { message } => { self.debug_message = format!("Field {}: ❌ {}", self.editor.current_field() + 1, message); }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user