on master help sign in
Revert "Fix #6605: Remove soft-wrap.enable option wrapping. (#6656)"
58e457aBlaž Hrastnik
helix-core/src/syntax.rs+3−1
@@ -555,7 +555,9 @@ impl LanguageConfiguration {
555#[serde(default, rename_all = "kebab-case", deny_unknown_fields)]
555#[serde(default, rename_all = "kebab-case", deny_unknown_fields)]
556pub struct SoftWrap {
556pub struct SoftWrap {
557 /// Soft wrap lines that exceed viewport width. Default to off
557 /// Soft wrap lines that exceed viewport width. Default to off
558+ // NOTE: Option on purpose because the struct is shared between language config and global config.
559+ // By default the option is None so that the language config falls back to the global config unless explicitly set.
558− pub enable: bool,
560+ pub enable: Option<bool>,
559 /// Maximum space left free at the end of the line.
561 /// Maximum space left free at the end of the line.
560 /// This space is used to wrap text at word boundaries. If that is not possible within this limit
562 /// This space is used to wrap text at word boundaries. If that is not possible within this limit
561 /// the word is simply split at the end of the line.
563 /// the word is simply split at the end of the line.
helix-view/src/document.rs+3−2
@@ -1444,8 +1444,9 @@ impl Document {
1444 .as_ref()
1444 .as_ref()
1445 .and_then(|config| config.soft_wrap.as_ref());
1445 .and_then(|config| config.soft_wrap.as_ref());
1446 let enable_soft_wrap = language_soft_wrap
1446 let enable_soft_wrap = language_soft_wrap
1447− .map(|soft_wrap| soft_wrap.enable)
1447+ .and_then(|soft_wrap| soft_wrap.enable)
1448− .unwrap_or_else(|| editor_soft_wrap.enable);
1448+ .or(editor_soft_wrap.enable)
1449+ .unwrap_or(false);
1449 let max_wrap = language_soft_wrap
1450 let max_wrap = language_soft_wrap
1450 .and_then(|soft_wrap| soft_wrap.max_wrap)
1451 .and_then(|soft_wrap| soft_wrap.max_wrap)
1451 .or(config.soft_wrap.max_wrap)
1452 .or(config.soft_wrap.max_wrap)