-
Sergey Bugaev authored
Normally, when Pango wraps a line after a space character, the space character itself is said to be collapsed, and is not counted towards the width of the line. This is implemented by adding a negative width adjustment (extra_width). This has been implemented in commit 86303ad2 "Handle break-after-space correctly", and a few follow-up fix-ups. There is a corner case: when the space we're trying to break at is the last character in the paragraph, it should not get collapsed. This has been implemented in commit 8ba98271 "layout: Fix a cornercase of line width accounting". However, due to parts of the logic being duplicated in different places, that patch forgot to update some of those places. Fix that by not collapsing the space width in the other parts of the logic too. In practice, this manifested as a Pango layout reporting to be wider than its explicit width limit (layout->width), because the final space was counted as collapsed (negative extra_width) when deciding whether to break the line, and as uncollapsed when measuring the resulting line width afterwards. That was in turn causing issues in GTK, where a GtkLabel widget would get confused because of this fact, and report an incorrect minimum width, and that, in turn, would be breaking assumptions in the layout machinery several layers up in the widget tree. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
14d66efb