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

don't break on hyphen with :reflow #8569

Merged
merged 4 commits into from
Oct 21, 2023

Conversation

Stephen-Seo
Copy link
Contributor

@Stephen-Seo Stephen-Seo commented Oct 19, 2023

This PR adds a new config option editor.no-break-on-hyphen that if set to true, will cause :reflow to not line-break on a hyphen. (By default this is false, which is the previous behavior.)

A use case for this behavior is in LaTeX, where if a line-break exists between a word, a hyphen, and another word, the hyphen'd words will not be properly displayed in the generated .pdf . bad linebreak in hyphen in LaTeX

Please let me know if I made a mistake.

@pascalkuthe
Copy link
Member

I think this could just be the default behaviour. Hypenization seems like it's almost never what you want in a plaintext document.

@pascalkuthe pascalkuthe added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. A-command Area: Commands labels Oct 20, 2023
@Stephen-Seo
Copy link
Contributor Author

I changed the default to adopt the new behavior, if that's ok with everyone.

Copy link
Member

@the-mikedavis the-mikedavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we actually need a config option for this? If it's sane behavior in all cases then I think we should just hardcode it and get rid of the config option. If it makes sense to break on hyphens only for some languages then this should be language-level configuration instead of editor-wide

@@ -65,6 +65,7 @@ Its settings will be merged with the configuration directory `config.toml` and t
| `workspace-lsp-roots` | Directories relative to the workspace root that are treated as LSP roots. Should only be set in `.helix/config.toml` | `[]` |
| `default-line-ending` | The line ending to use for new documents. Can be `native`, `lf`, `crlf`, `ff`, `cr` or `nel`. `native` uses the platform's native line ending (`crlf` on Windows, otherwise `lf`). | `native` |
| `insert-final-newline` | Whether to automatically insert a trailing line-ending on write if missing | `true` |
| `no-break-on-hyphen` | Disable linebreak on hyphen when using `:reflow` | `true` |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do introduce this option it should be named so that it's clear that it's for the reflow command, like reflow-break-on-hyphen

@pascalkuthe
Copy link
Member

Yeah I meant that we can hard-coded it and wouldn't need a config

@Stephen-Seo
Copy link
Contributor Author

Ok, I made a commit that reverted all changes and only has the behavior to not break in a hyphen. I guess the branch name is inaccurate now since there is no config option that changes this behavior. Is this ok with everyone?

@pascalkuthe
Copy link
Member

brnahc names don't really matter, don't worry about it

@pascalkuthe pascalkuthe changed the title Impl. option for ":reflow" to not break on hyphen don't break on hyphen with :reflow Oct 21, 2023
@the-mikedavis the-mikedavis merged commit 31f50bf into helix-editor:master Oct 21, 2023
6 checks passed
@Stephen-Seo Stephen-Seo deleted the no_break_on_hyphen_cfg branch October 21, 2023 13:11
danillos pushed a commit to danillos/helix that referenced this pull request Nov 21, 2023
dgkf pushed a commit to dgkf/helix that referenced this pull request Jan 30, 2024
mtoohey31 pushed a commit to mtoohey31/helix that referenced this pull request Jun 2, 2024
smortime pushed a commit to smortime/helix that referenced this pull request Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-command Area: Commands S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants