Fix indent_paragrahs/no final_gap line spacing bug #1079
Merged
+45
−1
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.