From 8dd1ab48997fe774165b3aee5d366833c9660710 Mon Sep 17 00:00:00 2001 From: Clément Delafargue Date: Wed, 8 Mar 2023 03:02:11 +0100 Subject: Softwrapping improvements (#5893) * use max_line_width + 1 during softwrap to account for newline char Helix softwrap implementation always wraps lines so that the newline character doesn't get cut off so he line wraps one chars earlier then in other editors. This is necessary, because newline chars are always selecatble in helix and must never be hidden. However That means that `max_line_width` currently wraps one char earlier than expected. The typical definition of line width does not include the newline character and other helix commands like `:reflow` also don't count the newline character here. This commit makes softwrap use `max_line_width + 1` instead of `max_line_width` to correct the impedance missmatch. * fix typos Co-authored-by: Jonathan Lebon * Add text-width to config.toml * text-width: update setting documentation * rename leftover config item * remove leftover max-line-length occurrences * Make `text-width` optional in editor config When it was only used for `:reflow` it made sense to have a default value set to `80`, but now that soft-wrapping uses this setting, keeping a default set to `80` would make soft-wrapping behave more aggressively. * Allow softwrapping to ignore `text-width` Softwrapping wraps by default to the viewport width or a configured `text-width` (whichever's smaller). In some cases we only want to set `text-width` to use for hard-wrapping and let longer lines flow if they have enough space. This setting allows that. * Revert "Make `text-width` optional in editor config" This reverts commit b247d526d69adf41434b6fd9c4983369c785aa22. * soft-wrap: allow per-language overrides * Update book/src/configuration.md Co-authored-by: Pascal Kuthe * Update book/src/languages.md Co-authored-by: Pascal Kuthe * Update book/src/configuration.md Co-authored-by: Pascal Kuthe --------- Co-authored-by: Pascal Kuthe Co-authored-by: Jonathan Lebon Co-authored-by: Alex Boehm Co-authored-by: Blaž Hrastnik --- languages.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'languages.toml') diff --git a/languages.toml b/languages.toml index 0fd37a00..8697f9fc 100644 --- a/languages.toml +++ b/languages.toml @@ -1104,7 +1104,7 @@ file-types = ["COMMIT_EDITMSG"] comment-token = "#" indent = { tab-width = 2, unit = " " } rulers = [50, 72] -max-line-length = 72 +text-width = 72 [[grammar]] name = "git-commit" -- cgit v1.2.3-70-g09d2