Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-term/src/commands/typed.rs')
| -rw-r--r-- | helix-term/src/commands/typed.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index fd741bf9..b570e50b 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -326,13 +326,13 @@ fn write_impl(cx: &mut compositor::Context, path: Option<&str>, force: bool) -> let jobs = &mut cx.jobs; let (view, doc) = current!(cx.editor); - if config.trim_trailing_whitespace { + if doc.trim_trailing_whitespace() { trim_trailing_whitespace(doc, view.id); } if config.trim_final_newlines { trim_final_newlines(doc, view.id); } - if config.insert_final_newline { + if doc.insert_final_newline() { insert_final_newline(doc, view.id); } @@ -738,13 +738,13 @@ pub fn write_all_impl( let doc = doc_mut!(cx.editor, &doc_id); let view = view_mut!(cx.editor, target_view); - if config.trim_trailing_whitespace { + if doc.trim_trailing_whitespace() { trim_trailing_whitespace(doc, target_view); } if config.trim_final_newlines { trim_final_newlines(doc, target_view); } - if config.insert_final_newline { + if doc.insert_final_newline() { insert_final_newline(doc, target_view); } @@ -2146,7 +2146,6 @@ fn reflow(cx: &mut compositor::Context, args: Args, event: PromptEvent) -> anyho } let scrolloff = cx.editor.config().scrolloff; - let cfg_text_width: usize = cx.editor.config().text_width; let (view, doc) = current!(cx.editor); // Find the text_width by checking the following sources in order: @@ -2157,8 +2156,7 @@ fn reflow(cx: &mut compositor::Context, args: Args, event: PromptEvent) -> anyho .first() .map(|num| num.parse::<usize>()) .transpose()? - .or_else(|| doc.language_config().and_then(|config| config.text_width)) - .unwrap_or(cfg_text_width); + .unwrap_or_else(|| doc.text_width()); let rope = doc.text(); |