Try to optimize
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
use std::cell::RefCell;
|
||||
use std::ops::RangeInclusive;
|
||||
|
||||
use cagire_ratatui::Editor;
|
||||
@@ -55,6 +56,14 @@ pub struct EditorContext {
|
||||
pub selection_anchor: Option<usize>,
|
||||
pub copied_steps: Option<CopiedSteps>,
|
||||
pub show_stack: bool,
|
||||
pub stack_cache: RefCell<Option<StackCache>>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct StackCache {
|
||||
pub cursor_line: usize,
|
||||
pub lines_hash: u64,
|
||||
pub result: String,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
@@ -96,6 +105,7 @@ impl Default for EditorContext {
|
||||
selection_anchor: None,
|
||||
copied_steps: None,
|
||||
show_stack: false,
|
||||
stack_cache: RefCell::new(None),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ pub mod ui;
|
||||
|
||||
pub use audio::{AudioSettings, DeviceKind, EngineSection, Metrics, SettingKind};
|
||||
pub use options::{OptionsFocus, OptionsState};
|
||||
pub use editor::{CopiedStepData, CopiedSteps, EditorContext, Focus, PatternField, PatternPropsField};
|
||||
pub use editor::{CopiedStepData, CopiedSteps, EditorContext, Focus, PatternField, PatternPropsField, StackCache};
|
||||
pub use live_keys::LiveKeyState;
|
||||
pub use modal::Modal;
|
||||
pub use panel::{PanelFocus, PanelState, SidePanel};
|
||||
|
||||
Reference in New Issue
Block a user