diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-04-08 14:56:06 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-04-08 15:15:51 +0300 |
commit | 89b3c9da48cf685361105df1ca2e9ed27ef240ae (patch) | |
tree | a1b2aa4e43fc556d1966ac73838373d824e73fab /source/blender/editors/interface/interface_ops.c | |
parent | 945b1143df1686f705fd8bf2ff05d04460aa52fa (diff) |
Text Editor: don't force other views to follow the cursor
While the existing behavior worked as intended,
it wasn't possible to have two views on the same file at different
locations.
Since there isn't much use in having two views open at the same location
allow one view to be at a different scroll location.
UI edit-source and selecting a text data block now need explicit calls
to scroll to the cursor location.
Resolves T87284
Diffstat (limited to 'source/blender/editors/interface/interface_ops.c')
-rw-r--r-- | source/blender/editors/interface/interface_ops.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 540e98f542e..62be13c11c9 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -72,6 +72,7 @@ #include "BKE_main.h" #include "BLI_ghash.h" #include "ED_screen.h" +#include "ED_text.h" /* -------------------------------------------------------------------- */ /** \name Copy Data Path Operator @@ -1336,18 +1337,23 @@ static int editsource_text_edit(bContext *C, return OPERATOR_CANCELLED; } + txt_move_toline(text, line - 1, false); + /* naughty!, find text area to set, not good behavior * but since this is a dev tool lets allow it - campbell */ ScrArea *area = BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_TEXT, 0); if (area) { SpaceText *st = area->spacedata.first; + ARegion *region = BKE_area_find_region_type(area, RGN_TYPE_WINDOW); st->text = text; + if (region) { + ED_text_scroll_to_cursor(st, region, true); + } } else { BKE_reportf(op->reports, RPT_INFO, "See '%s' in the text editor", text->id.name + 2); } - txt_move_toline(text, line - 1, false); WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, text); return OPERATOR_FINISHED; |