mirror of https://github.com/helix-editor/helix
Merge remote-tracking branch 'pascalkuthe/master' into max-line-len
commit
6aad3fffbe
|
@ -1232,7 +1232,12 @@ impl Document {
|
|||
|
||||
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) {
|
||||
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 soft_wrap = &config.soft_wrap;
|
||||
|
|
Loading…
Reference in New Issue