Skip to content

Commit

Permalink
adjust configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalkuthe committed Jan 16, 2023
1 parent 62ef0bc commit 71a544b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion book/src/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,10 @@ Options for soft wrapping lines that exceed the view width
| Key | Description | Default |
| --- | --- | --- |
| `enable` | Whether soft wrapping is enabled. | `false` |
| `max-wrap` | Maximum free space left at the end of the line. | `20` |
| `max-wrap` | Maximum free space left at the end of the line. | `20` |
| `max-indent-retain` | Maximum indentation to carry over when soft wrapping a line. | `40` |
| `wrap-indicator` | Text inserted before soft wrapped lines. | `` |
| | Highlighted with `ui.virtual.wrap`. | |

Example:

Expand Down
10 changes: 8 additions & 2 deletions helix-view/src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1210,7 +1210,13 @@ impl Document {
}
}

pub fn text_format(&self, viewport_width: u16, theme: Option<&Theme>) -> TextFormat {
pub fn text_format(&self, mut viewport_width: u16, theme: Option<&Theme>) -> TextFormat {
if let Some(max_line_len) = self
.language_config()
.and_then(|config| config.max_line_length)
{
viewport_width = viewport_width.min(max_line_len as u16)
}
let config = self.config.load();
let soft_wrap = &config.soft_wrap;
let tab_width = self.tab_width() as u16;
Expand All @@ -1224,7 +1230,7 @@ impl Document {
viewport_width,
wrap_indicator: soft_wrap.wrap_indicator.clone().into_boxed_str(),
wrap_indicator_highlight: theme
.and_then(|theme| theme.find_scope_index_exact("ui.virtual.whitespace"))
.and_then(|theme| theme.find_scope_index("ui.virtual.wrap"))
.map(Highlight),
}
}
Expand Down

0 comments on commit 71a544b

Please sign in to comment.