sway

i3-compatible Wayland compositor
git clone https://git.awy.one/sway
Log | Files | Refs | README | LICENSE

commit ba427a469a8394cb2fafa1a0602d6fd78c5c4d68
parent c8676fad54bb0f4152947a6781626872bfa6ad64
Author: Alexander Orzechowski <alex@ozal.ski>
Date:   Fri,  2 Feb 2024 00:35:53 +0100

Ensure get_text_width() returns a positive value

Closes: https://github.com/swaywm/sway/issues/7940

Diffstat:
Msway/sway_text_node.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 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) {