Skip to content

Commit

Permalink
Ensure get_text_width() returns a positive value
Browse files Browse the repository at this point in the history
Closes: #7940
  • Loading branch information
Nefsen402 authored and emersion committed Feb 1, 2024
1 parent c8676fa commit ba427a4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sway/sway_text_node.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit ba427a4

Please sign in to comment.