From 38391d9a7dd0406252f2ff0b525950929a79ac58 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 10 May 2013 20:34:35 +0000 Subject: Fix #35281: search menu buttons (with an X on the right side to clear) had text overlapping the X icon if the text was long. --- source/blender/editors/interface/interface_widgets.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'source/blender/editors/interface/interface_widgets.c') diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 4d529a847a5..bbc528a0a18 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -968,8 +968,14 @@ 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 = max_ii(BLI_rcti_size_x(rect) - border, 0); - if (but->flag & UI_HAS_ICON) okwidth -= UI_DPI_ICON_SIZE; + int okwidth = BLI_rcti_size_x(rect) - border; + + if (but->flag & UI_HAS_ICON) + okwidth -= UI_DPI_ICON_SIZE; + if (but->type == SEARCH_MENU_UNLINK && !but->editstr) + okwidth -= BLI_rcti_size_y(rect); + + okwidth = max_ii(okwidth, 0); /* need to set this first */ uiStyleFontSet(fstyle); @@ -1347,7 +1353,7 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB } /* unlink icon for this button type */ - if (but->type == SEARCH_MENU_UNLINK && but->drawstr[0]) { + if (but->type == SEARCH_MENU_UNLINK && !but->editstr && but->drawstr[0]) { rcti temp = *rect; temp.xmin = temp.xmax - (BLI_rcti_size_y(rect) * 1.08f); -- cgit v1.2.3