vim keybinings are now working properly well
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
// src/state/pages/add_logic.rs
|
||||
use crate::config::binds::config::{EditorConfig, EditorKeybindingMode};
|
||||
use crate::state::pages::canvas_state::CanvasState;
|
||||
use crate::components::common::text_editor::{TextEditor, VimState}; // Add VimState import
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
use tui_textarea::TextArea;
|
||||
// Removed unused Style, Color imports if not used in Default for TextArea styling
|
||||
// use ratatui::style::{Color, Style}; // Keep if you add custom styling in default()
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
|
||||
pub enum AddLogicFocus {
|
||||
@@ -31,13 +31,13 @@ pub struct AddLogicState {
|
||||
pub target_column_cursor_pos: usize,
|
||||
pub description_cursor_pos: usize,
|
||||
pub has_unsaved_changes: bool,
|
||||
pub editor_keybinding_mode: EditorKeybindingMode,
|
||||
pub vim_state: VimState, // Add this field
|
||||
}
|
||||
|
||||
impl Default for AddLogicState {
|
||||
fn default() -> Self {
|
||||
let editor = TextArea::default(); // No 'mut' needed if not modified further here
|
||||
// Example: editor.set_placeholder_text("Enter script...");
|
||||
// Example: editor.set_line_number_style(Style::default().fg(Color::DarkGray));
|
||||
impl AddLogicState {
|
||||
pub fn new(editor_config: &EditorConfig) -> Self {
|
||||
let editor = TextEditor::new_textarea(editor_config);
|
||||
AddLogicState {
|
||||
profile_name: "default".to_string(),
|
||||
selected_table_id: None,
|
||||
@@ -51,15 +51,21 @@ impl Default for AddLogicState {
|
||||
target_column_cursor_pos: 0,
|
||||
description_cursor_pos: 0,
|
||||
has_unsaved_changes: false,
|
||||
editor_keybinding_mode: editor_config.keybinding_mode.clone(),
|
||||
vim_state: VimState::default(), // Add this field initialization
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ... rest of the CanvasState impl remains the same
|
||||
impl AddLogicState {
|
||||
pub const INPUT_FIELD_COUNT: usize = 3;
|
||||
}
|
||||
|
||||
impl Default for AddLogicState {
|
||||
fn default() -> Self {
|
||||
Self::new(&EditorConfig::default())
|
||||
}
|
||||
}
|
||||
|
||||
// ... rest of the CanvasState implementation remains the same
|
||||
impl CanvasState for AddLogicState {
|
||||
fn current_field(&self) -> usize {
|
||||
match self.current_focus {
|
||||
|
||||
Reference in New Issue
Block a user