forked from bartvdbraak/blender
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
This commit is contained in:
parent
0d3f0ff08e
commit
9f6544b426
@ -117,12 +117,25 @@ static void text_listener(ScrArea *sa, wmNotifier *wmn)
|
|||||||
/* context changes */
|
/* context changes */
|
||||||
switch(wmn->category) {
|
switch(wmn->category) {
|
||||||
case NC_TEXT:
|
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);
|
ED_area_tag_redraw(sa);
|
||||||
|
|
||||||
if(wmn->action == NA_EDITED)
|
switch(wmn->action) {
|
||||||
|
case NA_EDITED:
|
||||||
if(st->text)
|
if(st->text)
|
||||||
text_update_edited(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;
|
break;
|
||||||
|
@ -357,7 +357,7 @@ static int unlink_exec(bContext *C, wmOperator *op)
|
|||||||
|
|
||||||
unlink_text(bmain, text);
|
unlink_text(bmain, text);
|
||||||
free_libblock(&bmain->text, 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;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user