Further improve status check of master-buffer-forall

This commit is contained in:
Juergen Spitzmueller 2020-01-02 14:09:01 +01:00
parent 9486ef6ade
commit 3f7b8db1b1

View File

@ -1971,13 +1971,23 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
if (doc_buffer == 0) {
flag.message(from_utf8(N_("Command not allowed without a buffer open")));
enable = false;
break;
}
FuncRequest const cmdToPass = lyxaction.lookupFunc(cmd.getLongArg(0));
if (cmdToPass.action() == LFUN_UNKNOWN_ACTION) {
flag.message(from_utf8(N_("the <LFUN-COMMAND> argument of master-buffer-forall is not valid")));
flag.message(from_utf8(N_("Invalid argument of master-buffer-forall")));
enable = false;
} else {
enable = true;
break;
}
enable = false;
for (Buffer * buf : doc_buffer->allRelatives()) {
GuiWorkArea * wa = workArea(*buf);
if (!wa)
continue;
if (wa->bufferView().getStatus(cmdToPass, flag)) {
enable = flag.enabled();
break;
}
}
break;
}