2025-07-05 14:42:45 -04:00
|
|
|
use super::editor::TextEditor;
|
|
|
|
|
use super::editor::TextProcessingResult;
|
|
|
|
|
use crate::app::{tab::Tab, theme::Theme};
|
|
|
|
|
use std::sync::{Arc, Mutex};
|
|
|
|
|
|
|
|
|
|
impl Default for TextEditor {
|
|
|
|
|
fn default() -> Self {
|
|
|
|
|
Self {
|
|
|
|
|
tabs: vec![Tab::new_empty(1)],
|
|
|
|
|
active_tab_index: 0,
|
|
|
|
|
tab_counter: 1,
|
|
|
|
|
show_about: false,
|
|
|
|
|
show_shortcuts: false,
|
|
|
|
|
show_find: false,
|
|
|
|
|
show_preferences: false,
|
|
|
|
|
pending_unsaved_action: None,
|
|
|
|
|
force_quit_confirmed: false,
|
|
|
|
|
clean_quit_requested: false,
|
|
|
|
|
show_line_numbers: false,
|
|
|
|
|
word_wrap: true,
|
|
|
|
|
auto_hide_toolbar: false,
|
2025-07-15 10:43:41 -04:00
|
|
|
auto_hide_tab_bar: true,
|
2025-07-05 14:42:45 -04:00
|
|
|
theme: Theme::default(),
|
|
|
|
|
line_side: false,
|
|
|
|
|
font_family: "Proportional".to_string(),
|
|
|
|
|
font_size: 14.0,
|
|
|
|
|
font_size_input: None,
|
|
|
|
|
zoom_factor: 1.0,
|
|
|
|
|
menu_interaction_active: false,
|
|
|
|
|
tab_bar_rect: None,
|
|
|
|
|
menu_bar_stable_until: None,
|
|
|
|
|
text_processing_result: Arc::new(Mutex::new(TextProcessingResult::default())),
|
|
|
|
|
processing_thread_handle: None,
|
|
|
|
|
// Find functionality
|
|
|
|
|
find_query: String::new(),
|
|
|
|
|
find_matches: Vec::new(),
|
|
|
|
|
current_match_index: None,
|
|
|
|
|
case_sensitive_search: false,
|
|
|
|
|
prev_show_find: false,
|
|
|
|
|
|
|
|
|
|
// Cursor tracking for smart scrolling
|
|
|
|
|
previous_cursor_position: None,
|
2025-07-15 00:42:01 -04:00
|
|
|
|
|
|
|
|
// Track previous content for incremental processing
|
|
|
|
|
previous_content: String::new(),
|
|
|
|
|
previous_cursor_char_index: None,
|
|
|
|
|
current_cursor_line: 0,
|
|
|
|
|
previous_cursor_line: 0,
|
2025-07-15 09:53:45 -04:00
|
|
|
font_settings_changed: false,
|
2025-07-05 14:42:45 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|