Skip to content

fix: block content alignment #698

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

Merged

Conversation

PriceHiller
Copy link
Contributor

This PR has two commits as part of it.

The first commit ensures when block contents have a single line at the correct indentation level and the rest of the contents are indented more than that line, the block contents won't have their indentation changed.

The second commit makes the block content indentation ignore blank lines. Meaning it won't modify indentation if a blank line is "underindented" relative to the header as it was previously.

I wrote tests as part of each commit to exercise each path. Please see them to see specific examples. Each commit has its own tests associated, so it may be easier to view them that way.

Let me know if there's anything else I can do :).

Previously, if a single line was correctly aligned with a block, but the
others were overindented it was possible for the overindented lines to
be unindented. This is not correct.

The overindented lines shouldn't shift at all if at least one of the
lines is correctly indented. This is to preserve manual formatting.

This commit ensures the above functionality.
Copy link
Member

@kristijanhusak kristijanhusak left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@kristijanhusak kristijanhusak merged commit 261c987 into nvim-orgmode:master Mar 12, 2024
SlayerOfTheBad pushed a commit to SlayerOfTheBad/orgmode that referenced this pull request Aug 16, 2024
* fix(indent): do not modify block indents if one line is correct

Previously, if a single line was correctly aligned with a block, but the
others were overindented it was possible for the overindented lines to
be unindented. This is not correct.

The overindented lines shouldn't shift at all if at least one of the
lines is correctly indented. This is to preserve manual formatting.

This commit ensures the above functionality.

* fix(indent): ignore blank lines for block content indentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants