working but some functionality is missing now

This commit is contained in:
filipriec
2025-02-28 20:39:24 +01:00
parent 9b290e1ad9
commit 55895cd4c5
4 changed files with 126 additions and 28 deletions

View File

@@ -1,3 +1,5 @@
// src/modes/handlers/read_only.rs
use crossterm::event::{KeyEvent};
use crate::config::config::Config;
use crate::ui::handlers::form::FormState;
@@ -24,13 +26,13 @@ pub async fn handle_read_only_event(
ideal_cursor_column: &mut usize,
) -> Result<(bool, String), Box<dyn std::error::Error>> {
// Check for entering Edit mode from Read-Only mode
if config.get_read_only_action_for_key(key.code, key.modifiers) == Some("enter_edit_mode_before") {
if config.is_enter_edit_mode_before(key.code, key.modifiers) {
*edit_mode_cooldown = true;
*command_message = "Entering Edit mode".to_string();
return Ok((false, command_message.clone()));
}
if config.get_read_only_action_for_key(key.code, key.modifiers) == Some("enter_edit_mode_after") {
if config.is_enter_edit_mode_after(key.code, key.modifiers) {
let current_input = form_state.get_current_input();
if !current_input.is_empty() && form_state.current_cursor_pos < current_input.len() {
form_state.current_cursor_pos += 1;