UI: report when reloading unsaved text

Address confusion from T78114.
This commit is contained in:
Campbell Barton 2020-06-22 15:59:02 +10:00
parent 56d0df51a3
commit 9215b5d869
Notes: blender-bot 2023-02-13 22:03:17 +01:00
Referenced by issue #78114, Blender Text Editor can't reload external files
1 changed files with 7 additions and 0 deletions

View File

@ -428,6 +428,13 @@ static int text_reload_exec(bContext *C, wmOperator *op)
const int orig_curl = BLI_findindex(&text->lines, text->curl);
const int orig_curc = text->curc;
/* Don't make this part of 'poll', since 'Alt-R' will type 'R',
* if poll checks for the filename. */
if (text->name == NULL) {
BKE_report(op->reports, RPT_ERROR, "This text has not been saved");
return OPERATOR_CANCELLED;
}
if (!BKE_text_reload(text)) {
BKE_report(op->reports, RPT_ERROR, "Could not reopen file");
return OPERATOR_CANCELLED;