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

Join empty lines with only one space in join_selections #8989

Merged
merged 7 commits into from
Dec 6, 2023

Conversation

TornaxO7
Copy link
Contributor

@TornaxO7 TornaxO7 commented Dec 4, 2023

fixes the issue that lines with only spaces are getting joined as well

fixes #8977

fixes the issue that lines with only spaces are getting
joined as well
helix-term/src/commands.rs Outdated Show resolved Hide resolved
helix-term/src/commands.rs Outdated Show resolved Hide resolved
@the-mikedavis the-mikedavis added C-bug Category: This is a bug 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 Dec 5, 2023
@the-mikedavis
Copy link
Member

This would be a good opportunity to add a test case for J to the integration tests in helix-term/tests/test/commands.rs

@the-mikedavis the-mikedavis changed the title fix: #8977 Join empty lines with only one space in join_selections Dec 5, 2023
@TornaxO7
Copy link
Contributor Author

TornaxO7 commented Dec 5, 2023

Damn, hm... may I ask if there's a possible way to start the tests for the other platforms so I can also try them locally?

@TornaxO7
Copy link
Contributor Author

TornaxO7 commented Dec 5, 2023

ok, just found act and I'll try with it.

@TornaxO7
Copy link
Contributor Author

TornaxO7 commented Dec 5, 2023

@the-mikedavis ok, could you please restart the workflow please? Hopefully it will work this time.

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.

This is looking good 👍

Just some small style nits

helix-term/src/commands.rs Outdated Show resolved Hide resolved
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.

Thanks for fixing this!

let separator = {
let line_end_index = line_end_char_index(&slice, line + 1);
let line_contains_only_space = end == line_end_index;
if line_contains_only_space {
Copy link
Member

Choose a reason for hiding this comment

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

You can use .then here

@pascalkuthe pascalkuthe merged commit b81aacc into helix-editor:master Dec 6, 2023
6 checks passed
@TornaxO7 TornaxO7 deleted the fix/join-space-lines branch December 6, 2023 16:10
Desdaemon pushed a commit to Desdaemon/helix that referenced this pull request Dec 11, 2023
…or#8989)

* fix: helix-editor#8977

fixes the issue that lines with only spaces are getting
joined as well

* reverting some renamings

* improve empty line check

* adding integration test

* reverting code block

* fix conditon check for line end

* applying suggested style
dgkf pushed a commit to dgkf/helix that referenced this pull request Jan 30, 2024
…or#8989)

* fix: helix-editor#8977

fixes the issue that lines with only spaces are getting
joined as well

* reverting some renamings

* improve empty line check

* adding integration test

* reverting code block

* fix conditon check for line end

* applying suggested style
mtoohey31 pushed a commit to mtoohey31/helix that referenced this pull request Jun 2, 2024
…or#8989)

* fix: helix-editor#8977

fixes the issue that lines with only spaces are getting
joined as well

* reverting some renamings

* improve empty line check

* adding integration test

* reverting code block

* fix conditon check for line end

* applying suggested style
Vulpesx pushed a commit to Vulpesx/helix that referenced this pull request Jun 7, 2024
…or#8989)

* fix: helix-editor#8977

fixes the issue that lines with only spaces are getting
joined as well

* reverting some renamings

* improve empty line check

* adding integration test

* reverting code block

* fix conditon check for line end

* applying suggested style
smortime pushed a commit to smortime/helix that referenced this pull request Jul 10, 2024
…or#8989)

* fix: helix-editor#8977

fixes the issue that lines with only spaces are getting
joined as well

* reverting some renamings

* improve empty line check

* adding integration test

* reverting code block

* fix conditon check for line end

* applying suggested style
@cezhunter
Copy link

is there a way to join lines without including spaces? Say you have something like

func
    .test()
    .evaluate()
    .whatever()

I want to join the lines into one but not have it be func .test() .evaluate() .whatever()

@TornaxO7
Copy link
Contributor Author

TornaxO7 commented Dec 4, 2024

Hm... we could introduce a special case: If the current line starts with a punctuation, the whitespace of the previous line should be omitted. The other question is: Is there a case where the whitespace shouldn't be removed if the current line starts with a punctuation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-command Area: Commands C-bug Category: This is a bug 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.

Joining lines with empty line adds 2 spaces when joined
4 participants