Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line is soft-wrapped even if within max-line-length limit #5810

Closed
jlebon opened this issue Feb 3, 2023 · 4 comments
Closed

Line is soft-wrapped even if within max-line-length limit #5810

jlebon opened this issue Feb 3, 2023 · 4 comments
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements

Comments

@jlebon
Copy link
Contributor

jlebon commented Feb 3, 2023

Summary

With soft-wrap.enable = true, when editing files with a max-line-length, lines may be soft-wrapped even if it would've fit within the max-line-length limit. This is most easily seen when writing git commits:

image

The singular A (preceded by a space) would've fit within column 72. :reflow calculates it correctly and does not break line, so the soft-wrap persists.

Platform

Linux

Terminal Emulator

tmux inside GNOME Terminal

Helix Version

22.12-218-gf7bd7b5e

@jlebon jlebon added the C-bug Category: This is a bug label Feb 3, 2023
@pascalkuthe
Copy link
Member

The reason for this is that newlines are always a selectable character in helix that takesup horizontal space. The line needs to be wrapped here because otherwise the newline character exceeds the 72 column width limit. I could change the max-line-length option to be interpreted as max-line-length + 1 for softwrap purposes to remedy that but that would not work correctly on the last line (which doesn't have a newline character).

@jlebon
Copy link
Contributor Author

jlebon commented Feb 3, 2023

The reason for this is that newlines are always a selectable character in helix that takesup horizontal space. The line needs to be wrapped here because otherwise the newline character exceeds the 72 column width limit.

Though note :reflow does not count the newline character towards the max-line-length limit. I expected the softwrap logic to also match this. If they don't agree, the rendering will not converge. To put this another way, I would expect a freshly :reflowed paragraph to not display any softwrapped lines.

@pascalkuthe
Copy link
Member

Yeah I suppose that is the lesser of two evils here. submitted #5813 with a fix

@kirawi kirawi added C-enhancement Category: Improvements A-helix-term Area: Helix term improvements and removed C-bug Category: This is a bug labels Feb 5, 2023
@gabydd
Copy link
Member

gabydd commented Mar 20, 2023

I believe this was fixed by #5893

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants