Skip to content

Commit 9b6f990

Browse files
committed
Fix GtkBackend text layout issue causing dry run size to differ from true size
This was causing window sizing to be a few pixels off, and probably caused a number of other subtle layout issues.
1 parent 8a53df4 commit 9b6f990

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Sources/SwiftCrossUI/Views/Text.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ public struct Text: ElementaryView, View {
2121
backend: Backend,
2222
dryRun: Bool
2323
) -> ViewSize {
24-
if !dryRun {
25-
backend.updateTextView(widget, content: string, environment: environment)
26-
}
24+
// TODO: Avoid this
25+
// Even in dry runs we must update the underlying text view widget
26+
// because GtkBackend currently relies on querying the widget for text
27+
// properties and such (via Pango).
28+
backend.updateTextView(widget, content: string, environment: environment)
2729

2830
let size = backend.size(
2931
of: string,

0 commit comments

Comments
 (0)