diff options
Diffstat (limited to 'source/blender/editors/interface/interface_widgets.c')
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index b25aac785a7..b0be614fa17 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1248,40 +1248,39 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b /* text button selection and cursor */ if (but->editstr && but->pos != -1) { - short t = 0, pos = 0; - short selsta_tmp, selend_tmp, selsta_draw, selwidth_draw; + /* text button selection */ if ((but->selend - but->selsta) > 0) { - /* text button selection */ - selsta_tmp = but->selsta; - selend_tmp = but->selend; + int selsta_draw, selwidth_draw; if (drawstr[0] != 0) { if (but->selsta >= but->ofs) { - selsta_draw = BLF_width(fstyle->uifont_id, drawstr + but->ofs, selsta_tmp - but->ofs); + selsta_draw = BLF_width(fstyle->uifont_id, drawstr + but->ofs, but->selsta - but->ofs); } else { selsta_draw = 0; } - selwidth_draw = BLF_width(fstyle->uifont_id, drawstr + but->ofs, selend_tmp - but->ofs); + selwidth_draw = BLF_width(fstyle->uifont_id, drawstr + but->ofs, but->selend - but->ofs); glColor4ubv((unsigned char *)wcol->item); - glRects(rect->xmin + selsta_draw, rect->ymin + 2, rect->xmin + selwidth_draw, rect->ymax - 2); + glRecti(rect->xmin + selsta_draw, + rect->ymin + 2, + min_ii(rect->xmin + selwidth_draw, rect->xmax - 2), + rect->ymax - 2); } } - else { - /* text cursor */ - pos = but->pos; - if (pos >= but->ofs) { - if (drawstr[0] != 0) { - t = BLF_width(fstyle->uifont_id, drawstr + but->ofs, pos - but->ofs); - } - glColor3f(0.20, 0.6, 0.9); - glRects(rect->xmin + t, rect->ymin + 2, rect->xmin + t + 2, rect->ymax - 2); + /* text cursor */ + if (but->pos >= but->ofs) { + int t; + if (drawstr[0] != 0) { + t = BLF_width(fstyle->uifont_id, drawstr + but->ofs, but->pos - but->ofs); } + + glColor3f(0.20, 0.6, 0.9); + glRecti(rect->xmin + t, rect->ymin + 2, rect->xmin + t + 2, rect->ymax - 2); } } |