Fix indent_paragrahs/no final_gap line spacing bug - #1079
Merged
pointlessone merged 1 commit intoJan 4, 2024
Merged
Conversation
jstasiak
force-pushed
the
fix-line-spacing-with-indentation-and-no-final_gap
branch
from
September 25, 2018 00:02
e89bedb to
42c7d0b
Compare
Contributor
Author
|
My first approach was buggy in case of single-line paragraphs, I just updated it. |
Contributor
|
@pointlessone Could you please rebase this one? I think we likely want to merge this once it's green. |
pointlessone
force-pushed
the
fix-line-spacing-with-indentation-and-no-final_gap
branch
from
February 15, 2022 11:56
42c7d0b to
9b586d0
Compare
In case of no indent_paragraphs when formatted_text is called it passes the text to render to Text.fill_formatted_text_box. Then the text is rendered using the Box class and the Box class in combination with the Wrap module takes care of spacing between lines. Spacing is present regardless of final_gap value. In case of indent_paragraphs set the situation is different. formatted_text itself prints the first line separately and then the rest of the text. As such, it has the responsibility to add spacing between the first line and the rest on its own. When final_gap is set, as it is by default, it works just fine. When final_gap is not set though, there was no space between the first line and the second line of the text. Since formatted_text calls draw_indented_formatted_line to render the first line and draw_indented_formatted_line calls fill_formatted_text_box with the single_line flag we can use the flag as a secondary way to trigger adding a gap. I also added a test case for a single line scenario because my initial take on this issue introduced a different bug that caused a single-line paragraph and another paragraph to have too much space between them.
pointlessone
force-pushed
the
fix-line-spacing-with-indentation-and-no-final_gap
branch
from
January 4, 2024 15:51
9b586d0 to
3fdbda8
Compare
pointlessone
approved these changes
Jan 4, 2024
Member
|
@jstasiak Thank you for your contribution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In case of no indent_paragraphs when formatted_text is called it
passes the text to render to Text.fill_formatted_text_box. Then the text
is rendered using the Box class and the Box class in combination with
the Wrap module takes care of spacing between lines. Spacing is present
regardless of final_gap value.
In case of indent_paragraphs set the situation is different.
formatted_text itself prints the first line separately and then the rest
of the text. As such, it has the responsibility to add spacing between
the first line and the rest on its own. When final_gap is set, as it is
by default, it works just fine. When final_gap is not set though, there
was no space between the first line and the second line of the text.
Since formatted_text calls draw_indented_formatted_line to render the
first line and draw_indented_formatted_line calls
fill_formatted_text_box with the single_line flag we can use the flag as
a secondary way to trigger adding a gap.