Fix #35252: Crash with the node placed partially behind the screen
Issue was caused by negative maximal possible text width happening in label clipping. Solved by clamping width to 0 if it's negative.
This commit is contained in:
@@ -968,7 +968,7 @@ static void ui_text_clip_give_next_off(uiBut *but)
|
||||
static void ui_text_clip_left(uiFontStyle *fstyle, uiBut *but, const rcti *rect)
|
||||
{
|
||||
int border = (but->flag & UI_BUT_ALIGN_RIGHT) ? 8 : 10;
|
||||
int okwidth = BLI_rcti_size_x(rect) - border;
|
||||
int okwidth = max_ii(BLI_rcti_size_x(rect) - border, 0);
|
||||
if (but->flag & UI_HAS_ICON) okwidth -= UI_DPI_ICON_SIZE;
|
||||
|
||||
/* need to set this first */
|
||||
@@ -997,7 +997,7 @@ static void ui_text_clip_left(uiFontStyle *fstyle, uiBut *but, const rcti *rect)
|
||||
static void ui_text_clip_cursor(uiFontStyle *fstyle, uiBut *but, const rcti *rect)
|
||||
{
|
||||
int border = (but->flag & UI_BUT_ALIGN_RIGHT) ? 8 : 10;
|
||||
int okwidth = BLI_rcti_size_x(rect) - border;
|
||||
int okwidth = max_ii(BLI_rcti_size_x(rect) - border, 0);
|
||||
if (but->flag & UI_HAS_ICON) okwidth -= UI_DPI_ICON_SIZE;
|
||||
|
||||
BLI_assert(but->editstr && but->pos >= 0);
|
||||
@@ -1061,7 +1061,7 @@ static void ui_text_clip_cursor(uiFontStyle *fstyle, uiBut *but, const rcti *rec
|
||||
static void ui_text_clip_right_label(uiFontStyle *fstyle, uiBut *but, const rcti *rect)
|
||||
{
|
||||
int border = (but->flag & UI_BUT_ALIGN_RIGHT) ? 8 : 10;
|
||||
int okwidth = BLI_rcti_size_x(rect) - border;
|
||||
int okwidth = max_ii(BLI_rcti_size_x(rect) - border, 0);
|
||||
char *cpoin = NULL;
|
||||
int drawstr_len = strlen(but->drawstr);
|
||||
char *cpend = but->drawstr + drawstr_len;
|
||||
|
||||
Reference in New Issue
Block a user