From af88a3c15cc4ddbb1e2f2ea6492868ffb8aba40b Mon Sep 17 00:00:00 2001 From: gibbz00 Date: Sat, 8 Apr 2023 14:18:11 +0200 Subject: [PATCH] Fix #6605: Remove soft-wrap.enable option wrapping. (#6656) Co-authored-by: gibbz00 --- helix-core/src/syntax.rs | 2 +- helix-view/src/document.rs | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index 408469675..0e6696db0 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -555,7 +555,7 @@ fn load_query(&self, kind: &str) -> Option { #[serde(default, rename_all = "kebab-case", deny_unknown_fields)] pub struct SoftWrap { /// Soft wrap lines that exceed viewport width. Default to off - pub enable: Option, + 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. diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index eca600265..65a5a6e22 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -1444,9 +1444,8 @@ pub fn text_format(&self, mut viewport_width: u16, theme: Option<&Theme>) -> Tex .as_ref() .and_then(|config| config.soft_wrap.as_ref()); let enable_soft_wrap = language_soft_wrap - .and_then(|soft_wrap| soft_wrap.enable) - .or(editor_soft_wrap.enable) - .unwrap_or(false); + .map(|soft_wrap| soft_wrap.enable) + .unwrap_or_else(|| editor_soft_wrap.enable); let max_wrap = language_soft_wrap .and_then(|soft_wrap| soft_wrap.max_wrap) .or(config.soft_wrap.max_wrap)