UI: uiBut Indeterminate State #108210

Merged
Julian Eisel merged 15 commits from Harley/blender:Indeterminate into main 2023-07-17 19:37:24 +02:00
1 changed files with 3 additions and 0 deletions
Showing only changes of commit 9d430d6219 - Show all commits

View File

@ -1948,6 +1948,9 @@ static void widget_draw_text(const uiFontStyle *fstyle,
{
STRNCPY(but->drawstr, UI_VALUE_INDETERMINATE_CHAR);
Harley marked this conversation as resolved
Review

Do not modify but->drawstr here, the function shouldn't have such side effects. Modify the local drawstr instead.

Do not modify `but->drawstr` here, the function shouldn't have such side effects. Modify the local `drawstr` instead.
align = UI_STYLE_TEXT_CENTER;
use_right_only = false;
Harley marked this conversation as resolved Outdated

This doesn't have any impact, use_right_only is already false at this point, and may only be set to true later. Same for drawstr_right.

I think a bool drawstr_overridden makes sense. When true we don't draw right aligned text. This could also be set when but->editstr is true.

This doesn't have any impact, `use_right_only` is already false at this point, and may only be set to true later. Same for `drawstr_right`. I think a `bool drawstr_overridden` makes sense. When true we don't draw right aligned text. This could also be set when `but->editstr` is true.
drawstr_right = nullptr;
drawstr_left_len = strlen(but->drawstr);
}
/* text button selection, cursor, composite underline */