aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sway/sway_text_node.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sway/sway_text_node.c b/sway/sway_text_node.c
index b9a77d94..664db40e 100644
--- a/sway/sway_text_node.c
+++ b/sway/sway_text_node.c
@@ -58,11 +58,11 @@ struct text_buffer {
};
static int get_text_width(struct sway_text_node *props) {
+ int width = props->width;
if (props->max_width) {
- return MIN(props->max_width, props->width);
+ width = MIN(width, props->max_width);
}
-
- return props->width;
+ return MAX(width, 0);
}
static void update_source_box(struct text_buffer *buffer) {