Fix unreported: Partial revert changes from #115247 #116392

Open
Guillermo Venegas wants to merge 1 commits from guishe/blender:txt-search-fix-panel into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
3 changed files with 12 additions and 14 deletions

View File

@ -377,6 +377,16 @@ static void text_properties_region_init(wmWindowManager *wm, ARegion *region)
static void text_properties_region_draw(const bContext *C, ARegion *region)
{
ED_region_panels(C, region);
SpaceText *st = CTX_wm_space_text(C);
/** This flag trick is make sure buttons have been added already. */
if (st->flags & ST_FIND_ACTIVATE) {
if (UI_textbutton_activate_rna(C, region, st, "find_text")) {
/** Draw again so `find_text` text button is highlighted as active. */
ED_region_panels(C, region);
}
st->flags &= ~ST_FIND_ACTIVATE;
}
}
static void text_id_remap(ScrArea * /*area*/, SpaceLink *slink, const IDRemapper *mappings)

View File

@ -81,27 +81,15 @@ static int text_text_search_exec(bContext *C, wmOperator * /*op*/)
}
}
bool draw = false;
if (region->flag & RGN_FLAG_HIDDEN) {
ED_region_toggle_hidden(C, region);
draw = true;
}
const char *active_category = UI_panel_category_active_get(region, false);
if (active_category && !STREQ(active_category, "Text")) {
UI_panel_category_active_set(region, "Text");
draw = true;
}
/* Build the layout and draw so `find_text` text button can be activated. */
if (draw) {
ED_region_do_layout(C, region);
ED_region_do_draw(C, region);
}
UI_textbutton_activate_rna(C, region, st, "find_text");
st->flags |= ST_FIND_ACTIVATE;
ED_region_tag_redraw(region);
}
return OPERATOR_FINISHED;

View File

@ -1475,7 +1475,7 @@ typedef enum eSpaceText_Flags {
ST_SHOW_MARGIN = (1 << 7),
ST_MATCH_CASE = (1 << 8),
ST_FLAG_UNUSED_9 = (1 << 9), /* Dirty. */
ST_FIND_ACTIVATE = (1 << 9),
} eSpaceText_Flags;