|
|
@ -1232,7 +1232,12 @@ impl Document {
|
|
|
|
|
|
|
|
|
|
|
|
pub fn text_format(&self, mut viewport_width: u16, theme: Option<&Theme>) -> TextFormat {
|
|
|
|
pub fn text_format(&self, mut viewport_width: u16, theme: Option<&Theme>) -> TextFormat {
|
|
|
|
if let Some(text_width) = self.language_config().and_then(|config| config.text_width) {
|
|
|
|
if let Some(text_width) = self.language_config().and_then(|config| config.text_width) {
|
|
|
|
viewport_width = viewport_width.min(text_width as u16)
|
|
|
|
// We increase max_line_len by 1 because softwrap considers the newline character
|
|
|
|
|
|
|
|
// as part of the line length while the "typical" expectation is that this is not the case.
|
|
|
|
|
|
|
|
// In particular other commands like :reflow do not count the line terminator.
|
|
|
|
|
|
|
|
// This is technically inconsistent for the last line as that line never has a line terminator
|
|
|
|
|
|
|
|
// but having the last visual line exceed the width by 1 seems like a rare edge case.
|
|
|
|
|
|
|
|
viewport_width = viewport_width.min(text_width as u16 + 1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
let config = self.config.load();
|
|
|
|
let config = self.config.load();
|
|
|
|
let soft_wrap = &config.soft_wrap;
|
|
|
|
let soft_wrap = &config.soft_wrap;
|
|
|
|