diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2010-09-25 17:27:42 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2010-09-25 17:27:42 +0400 |
commit | 9f6544b426da0e6334c59cee375fcab942660854 (patch) | |
tree | a057eebac0b25570082aaa2ad187669b966b810b /source/blender/editors/space_text | |
parent | 0d3f0ff08e2066de33165fa3153fd081fc394aaa (diff) |
Fix #23983: Text editor does not update immediately when unlinking a text
- Unlinked text block was sending as reference to note which isn't safe at all
- Minor reorgonize of text space listener to use switches instead of big condition
Diffstat (limited to 'source/blender/editors/space_text')
-rw-r--r-- | source/blender/editors/space_text/space_text.c | 17 | ||||
-rw-r--r-- | source/blender/editors/space_text/text_ops.c | 2 |
2 files changed, 16 insertions, 3 deletions
diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index c8c19a0bc93..ada2a6ee200 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -117,12 +117,25 @@ static void text_listener(ScrArea *sa, wmNotifier *wmn) /* context changes */ switch(wmn->category) { case NC_TEXT: - if(!wmn->reference || wmn->reference == st->text || wmn->data == ND_DISPLAY || wmn->action == NA_EDITED) { + /* check if active text was changed, no need to redraw if text isn't active + reference==NULL means text was unlinked, should update anyway for this + case -- no way to know was text active before unlinking or not */ + if(wmn->reference && wmn->reference != st->text) + break; + + if(wmn->data == ND_DISPLAY) ED_area_tag_redraw(sa); - if(wmn->action == NA_EDITED) + switch(wmn->action) { + case NA_EDITED: if(st->text) text_update_edited(st->text); + ED_area_tag_redraw(sa); + /* no break -- fall down to tag redraw */ + case NA_ADDED: + case NA_REMOVED: + ED_area_tag_redraw(sa); + break; } break; diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index d39056c6bbc..ed70f31f970 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -357,7 +357,7 @@ static int unlink_exec(bContext *C, wmOperator *op) unlink_text(bmain, text); free_libblock(&bmain->text, text); - WM_event_add_notifier(C, NC_TEXT|NA_REMOVED, text); + WM_event_add_notifier(C, NC_TEXT|NA_REMOVED, NULL); return OPERATOR_FINISHED; } |