diff options
Diffstat (limited to 'helix-view/src/editor.rs')
-rw-r--r-- | helix-view/src/editor.rs | 42 |
1 files changed, 4 insertions, 38 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index b96eec8d..5b819b33 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -42,7 +42,7 @@ pub use helix_core::diagnostic::Severity; pub use helix_core::register::Registers; use helix_core::{ auto_pairs::AutoPairs, - syntax::{self, AutoPairConfig}, + syntax::{self, AutoPairConfig, SoftWrap}, Change, }; use helix_core::{Position, Selection}; @@ -241,6 +241,8 @@ pub struct Config { pub auto_format: bool, /// Automatic save on focus lost. Defaults to false. pub auto_save: bool, + /// Set a global text_width + pub text_width: usize, /// Time in milliseconds since last keypress before idle timers trigger. /// Used for autocompletion, set to 0 for instant. Defaults to 400ms. #[serde( @@ -276,43 +278,6 @@ pub struct Config { pub soft_wrap: SoftWrap, } -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -#[serde(default, rename_all = "kebab-case", deny_unknown_fields)] -pub struct SoftWrap { - /// Soft wrap lines that exceed viewport width. Default to off - pub enable: bool, - /// Maximum space left free at the end of the line. - /// This space is used to wrap text at word boundaries. If that is not possible within this limit - /// the word is simply split at the end of the line. - /// - /// This is automatically hard-limited to a quarter of the viewport to ensure correct display on small views. - /// - /// Default to 20 - pub max_wrap: u16, - /// Maximum number of indentation that can be carried over from the previous line when softwrapping. - /// If a line is indented further then this limit it is rendered at the start of the viewport instead. - /// - /// This is automatically hard-limited to a quarter of the viewport to ensure correct display on small views. - /// - /// Default to 40 - pub max_indent_retain: u16, - /// Indicator placed at the beginning of softwrapped lines - /// - /// Defaults to ↪ - pub wrap_indicator: String, -} - -impl Default for SoftWrap { - fn default() -> Self { - SoftWrap { - enable: false, - max_wrap: 20, - max_indent_retain: 40, - wrap_indicator: "↪ ".into(), - } - } -} - #[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(default, rename_all = "kebab-case", deny_unknown_fields)] pub struct TerminalConfig { @@ -772,6 +737,7 @@ impl Default for Config { indent_guides: IndentGuidesConfig::default(), color_modes: false, soft_wrap: SoftWrap::default(), + text_width: 80, } } } |