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

Fix mangled newlines in some code blocks #387

Merged
merged 2 commits into from
Oct 21, 2022
Merged

Conversation

n-peugnet
Copy link
Contributor

@n-peugnet n-peugnet commented Oct 10, 2022

Because some tokens can contain newlines and not only comment tokens, I removed the comments specific code to handle newlines in a more generic way.

Before

2022-10-10-184125_975x737_scrot

After

2022-10-10-185740_975x722_scrot

Before

2022-10-10-184340_765x527_scrot

After

2022-10-10-184522_765x527_scrot

Fixes #274
Fixes #213

@n-peugnet
Copy link
Contributor Author

I just found out this change kind of breaks the "plain text" mode (^L). I'm investigating this right now.

@n-peugnet
Copy link
Contributor Author

n-peugnet commented Oct 13, 2022

I added a third patch to preserve the whitespace characters at the beginning and end of the codeblocks. I am not sure if it could cause other problems, but it seems to be sensible and I didn't have any issue with my limited testing. It does not affect the plaintext mode though.

This is mostly important for indentation when the first line does not start from the first column:

Before f213755

2022-10-13-175505_863x182_scrot

After f213755

2022-10-13-175411_863x182_scrot

EDIT: This third patch seems to introduce a crash sometimes.

Because some tokens can contain newlines and not only comment tokens, I
removed the comments specific code to handle newlines in a more generic
way.
@n-peugnet
Copy link
Contributor Author

As I just had a crash with the third commit. I removed it from this pull request (and rebased it by the way) to be able to merge it faster.

Copy link
Owner

@tulir tulir left a comment

Choose a reason for hiding this comment

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

Looks like it should probably work

@tulir tulir merged commit 99a5c7c into tulir:master Oct 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants