Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-04-08 14:56:06 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-04-08 15:15:51 +0300
commit89b3c9da48cf685361105df1ca2e9ed27ef240ae (patch)
treea1b2aa4e43fc556d1966ac73838373d824e73fab /source/blender/editors/space_text
parent945b1143df1686f705fd8bf2ff05d04460aa52fa (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/space_text')
-rw-r--r--source/blender/editors/space_text/space_text.c13
-rw-r--r--source/blender/editors/space_text/text_draw.c4
-rw-r--r--source/blender/editors/space_text/text_intern.h1
-rw-r--r--source/blender/editors/space_text/text_ops.c8
4 files changed, 6 insertions, 20 deletions
diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c
index 98faf89f8ae..af783051661 100644
--- a/source/blender/editors/space_text/space_text.c
+++ b/source/blender/editors/space_text/space_text.c
@@ -138,13 +138,7 @@ static void text_listener(const wmSpaceTypeListenerParams *params)
switch (wmn->data) {
case ND_DISPLAY:
- ED_area_tag_redraw(area);
- break;
case ND_CURSOR:
- if (st->text && st->text == wmn->reference) {
- text_scroll_to_cursor__area(st, area, true);
- }
-
ED_area_tag_redraw(area);
break;
}
@@ -160,13 +154,8 @@ static void text_listener(const wmSpaceTypeListenerParams *params)
ATTR_FALLTHROUGH; /* fall down to tag redraw */
case NA_ADDED:
case NA_REMOVED:
- ED_area_tag_redraw(area);
- break;
case NA_SELECTED:
- if (st->text && st->text == wmn->reference) {
- text_scroll_to_cursor__area(st, area, true);
- }
-
+ ED_area_tag_redraw(area);
break;
}
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index 8b8034124d9..17831c95575 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -1739,7 +1739,7 @@ void text_update_character_width(SpaceText *st)
/* Moves the view to the cursor location,
* also used to make sure the view isn't outside the file */
-void text_scroll_to_cursor(SpaceText *st, ARegion *region, const bool center)
+void ED_text_scroll_to_cursor(SpaceText *st, ARegion *region, const bool center)
{
Text *text;
int i, x, winx = region->winx;
@@ -1818,7 +1818,7 @@ void text_scroll_to_cursor__area(SpaceText *st, ScrArea *area, const bool center
region = BKE_area_find_region_type(area, RGN_TYPE_WINDOW);
if (region) {
- text_scroll_to_cursor(st, region, center);
+ ED_text_scroll_to_cursor(st, region, center);
}
}
diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h
index a33af56e11a..241e0133a8a 100644
--- a/source/blender/editors/space_text/text_intern.h
+++ b/source/blender/editors/space_text/text_intern.h
@@ -39,7 +39,6 @@ void draw_text_main(struct SpaceText *st, struct ARegion *region);
void text_update_line_edited(struct TextLine *line);
void text_update_edited(struct Text *text);
void text_update_character_width(struct SpaceText *st);
-void text_scroll_to_cursor(struct SpaceText *st, struct ARegion *region, const bool center);
void text_scroll_to_cursor__area(struct SpaceText *st, struct ScrArea *area, const bool center);
void text_update_cursor_moved(struct bContext *C);
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 526285c076a..e6803d12a42 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -506,12 +506,10 @@ static int text_unlink_exec(bContext *C, wmOperator *UNUSED(op))
if (text->id.prev) {
st->text = text->id.prev;
text_update_cursor_moved(C);
- WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, st->text);
}
else if (text->id.next) {
st->text = text->id.next;
text_update_cursor_moved(C);
- WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, st->text);
}
}
@@ -3200,7 +3198,7 @@ static void text_cursor_set_apply(bContext *C, wmOperator *op, const wmEvent *ev
if (event->type == TIMER) {
text_cursor_set_to_pos(st, region, event->mval[0], event->mval[1], 1);
- text_scroll_to_cursor(st, region, false);
+ ED_text_scroll_to_cursor(st, region, false);
WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, st->text);
}
}
@@ -3210,7 +3208,7 @@ static void text_cursor_set_apply(bContext *C, wmOperator *op, const wmEvent *ev
if (event->type == TIMER) {
text_cursor_set_to_pos(
st, region, CLAMPIS(event->mval[0], 0, region->winx), event->mval[1], 1);
- text_scroll_to_cursor(st, region, false);
+ ED_text_scroll_to_cursor(st, region, false);
WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, st->text);
}
}
@@ -3219,7 +3217,7 @@ static void text_cursor_set_apply(bContext *C, wmOperator *op, const wmEvent *ev
if (event->type != TIMER) {
text_cursor_set_to_pos(st, region, event->mval[0], event->mval[1], 1);
- text_scroll_to_cursor(st, region, false);
+ ED_text_scroll_to_cursor(st, region, false);
WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, st->text);
ssel->mval_prev[0] = event->mval[0];