Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix indent_paragrahs/no final_gap line spacing bug
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.
- Loading branch information