colors #6
@ -21,6 +21,8 @@ pub struct Config {
|
|||||||
pub font_family: String,
|
pub font_family: String,
|
||||||
#[serde(default = "default_font_size")]
|
#[serde(default = "default_font_size")]
|
||||||
pub font_size: f32,
|
pub font_size: f32,
|
||||||
|
#[serde(default = "default_syntax_highlighting")]
|
||||||
|
pub syntax_highlighting: bool,
|
||||||
// pub vim_mode: bool,
|
// pub vim_mode: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,18 +47,22 @@ fn default_font_family() -> String {
|
|||||||
fn default_font_size() -> f32 {
|
fn default_font_size() -> f32 {
|
||||||
14.0
|
14.0
|
||||||
}
|
}
|
||||||
|
fn default_syntax_highlighting() -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
impl Default for Config {
|
impl Default for Config {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
auto_hide_toolbar: false,
|
auto_hide_toolbar: default_auto_hide_toolbar(),
|
||||||
hide_tab_bar: true,
|
hide_tab_bar: default_hide_tab_bar(),
|
||||||
show_line_numbers: false,
|
show_line_numbers: default_show_line_numbers(),
|
||||||
word_wrap: true,
|
word_wrap: default_word_wrap(),
|
||||||
theme: Theme::default(),
|
theme: Theme::default(),
|
||||||
line_side: false,
|
line_side: default_line_side(),
|
||||||
font_family: "Proportional".to_string(),
|
font_family: default_font_family(),
|
||||||
font_size: 14.0,
|
font_size: default_font_size(),
|
||||||
|
syntax_highlighting: default_syntax_highlighting(),
|
||||||
// vim_mode: false,
|
// vim_mode: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,21 +1,10 @@
|
|||||||
use super::editor::TextEditor;
|
use super::editor::TextEditor;
|
||||||
use crate::app::config::Config;
|
use crate::app::config::Config;
|
||||||
use crate::app::tab::Tab;
|
|
||||||
use crate::app::theme;
|
use crate::app::theme;
|
||||||
|
|
||||||
impl TextEditor {
|
impl TextEditor {
|
||||||
pub fn from_config(config: Config) -> Self {
|
pub fn from_config(config: Config) -> Self {
|
||||||
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: config.show_line_numbers,
|
show_line_numbers: config.show_line_numbers,
|
||||||
word_wrap: config.word_wrap,
|
word_wrap: config.word_wrap,
|
||||||
auto_hide_toolbar: config.auto_hide_toolbar,
|
auto_hide_toolbar: config.auto_hide_toolbar,
|
||||||
@ -24,30 +13,8 @@ impl TextEditor {
|
|||||||
line_side: config.line_side,
|
line_side: config.line_side,
|
||||||
font_family: config.font_family,
|
font_family: config.font_family,
|
||||||
font_size: config.font_size,
|
font_size: config.font_size,
|
||||||
font_size_input: None,
|
syntax_highlighting: config.syntax_highlighting,
|
||||||
zoom_factor: 1.0,
|
..Default::default()
|
||||||
menu_interaction_active: false,
|
|
||||||
tab_bar_rect: None,
|
|
||||||
menu_bar_stable_until: None,
|
|
||||||
text_processing_result: std::sync::Arc::new(std::sync::Mutex::new(Default::default())),
|
|
||||||
_processing_thread_handle: None,
|
|
||||||
find_query: String::new(),
|
|
||||||
replace_query: String::new(),
|
|
||||||
find_matches: Vec::new(),
|
|
||||||
current_match_index: None,
|
|
||||||
case_sensitive_search: false,
|
|
||||||
show_replace_section: false,
|
|
||||||
prev_show_find: false,
|
|
||||||
focus_find: false,
|
|
||||||
// vim_mode: config.vim_mode,
|
|
||||||
previous_cursor_position: None,
|
|
||||||
previous_content: String::new(),
|
|
||||||
previous_cursor_char_index: None,
|
|
||||||
current_cursor_line: 0,
|
|
||||||
previous_cursor_line: 0,
|
|
||||||
font_settings_changed: false,
|
|
||||||
text_needs_processing: false,
|
|
||||||
should_select_current_match: false,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,6 +54,7 @@ impl TextEditor {
|
|||||||
line_side: self.line_side,
|
line_side: self.line_side,
|
||||||
font_family: self.font_family.to_string(),
|
font_family: self.font_family.to_string(),
|
||||||
font_size: self.font_size,
|
font_size: self.font_size,
|
||||||
|
syntax_highlighting: self.syntax_highlighting,
|
||||||
// vim_mode: self.vim_mode,
|
// vim_mode: self.vim_mode,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,7 @@ impl Default for TextEditor {
|
|||||||
word_wrap: true,
|
word_wrap: true,
|
||||||
auto_hide_toolbar: false,
|
auto_hide_toolbar: false,
|
||||||
hide_tab_bar: true,
|
hide_tab_bar: true,
|
||||||
|
syntax_highlighting: false,
|
||||||
theme: Theme::default(),
|
theme: Theme::default(),
|
||||||
line_side: false,
|
line_side: false,
|
||||||
font_family: "Proportional".to_string(),
|
font_family: "Proportional".to_string(),
|
||||||
|
|||||||
@ -45,6 +45,7 @@ pub struct TextEditor {
|
|||||||
pub(crate) word_wrap: bool,
|
pub(crate) word_wrap: bool,
|
||||||
pub(crate) auto_hide_toolbar: bool,
|
pub(crate) auto_hide_toolbar: bool,
|
||||||
pub(crate) hide_tab_bar: bool,
|
pub(crate) hide_tab_bar: bool,
|
||||||
|
pub(crate) syntax_highlighting: bool,
|
||||||
pub(crate) theme: Theme,
|
pub(crate) theme: Theme,
|
||||||
pub(crate) line_side: bool,
|
pub(crate) line_side: bool,
|
||||||
pub(crate) font_family: String,
|
pub(crate) font_family: String,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user