void text_update_cursor_moved(bContext *C) { ScrArea *sa = CTX_wm_area(C); SpaceText *st = CTX_wm_space_text(C); text_scroll_to_cursor(st, sa); }
/* takes an area instead of a region, use for listeners */ void text_scroll_to_cursor__area(SpaceText *st, ScrArea *sa, const bool center) { ARegion *ar; if (ELEM(NULL, st, st->text, st->text->curl)) return; ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); if (ar) { text_scroll_to_cursor(st, ar, center); } }