helix/helix-view/src
Clément Delafargue 8dd1ab4899
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 <jonathan@jlebon.com>

* 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 b247d526d6.

* soft-wrap: allow per-language overrides

* Update book/src/configuration.md

Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>

* Update book/src/languages.md

Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>

* Update book/src/configuration.md

Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>

---------

Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
Co-authored-by: Jonathan Lebon <jonathan@jlebon.com>
Co-authored-by: Alex Boehm <alexb@ozrunways.com>
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2023-03-08 11:02:11 +09:00
..
handlers feat(dap): send Disconnect if Terminated event received (#5532) 2023-02-20 13:00:00 +09:00
base64.rs Fix new clippy lints (#5892) 2023-02-09 16:27:08 -06:00
clipboard.rs Fix new clippy lints (#5892) 2023-02-09 16:27:08 -06:00
document.rs Softwrapping improvements (#5893) 2023-03-08 11:02:11 +09:00
editor.rs Softwrapping improvements (#5893) 2023-03-08 11:02:11 +09:00
env.rs Use OSC 52 as a fallback for setting the system clipboard (#3220) 2022-11-02 10:12:40 +09:00
graphics.rs Fix lacking space panic (#6109) 2023-03-05 20:43:24 +09:00
gutter.rs Add command for resetting diff hunks (#5736) 2023-03-08 10:49:14 +09:00
info.rs fix: remove unneeded allocations when calling helix_view::Info::new 2022-10-11 15:47:11 +09:00
input.rs Fix new clippy lints (#5892) 2023-02-09 16:27:08 -06:00
keyboard.rs refactor(helix-view): remove cfg_attr references a nonexistent feature (#5630) 2023-01-22 23:34:14 +05:30
lib.rs rework positioning/rendering and enable softwrap/virtual text (#5420) 2023-02-01 02:03:19 +09:00
macros.rs Apply transactions to all views (#4733) 2022-11-23 12:28:49 +09:00
theme.rs rework positioning/rendering and enable softwrap/virtual text (#5420) 2023-02-01 02:03:19 +09:00
tree.rs Add configuration for min width of line-numbers gutter (#4724) 2023-01-21 14:20:59 -06:00
view.rs Fix scrolloff at view bottom (#6142) 2023-03-03 10:05:40 -06:00