[LyX/master] Slightly better status of master-buffer-forall

Juergen Spitzmueller spitz at lyx.org
Tue Dec 31 17:30:37 UTC 2019


commit af9651a6a565082612934fdf3d208c2d3c065b45
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Tue Dec 31 18:46:33 2019 +0100

    Slightly better status of master-buffer-forall
---
 src/frontends/qt/GuiView.cpp |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp
index a783911..428d0ce 100644
--- a/src/frontends/qt/GuiView.cpp
+++ b/src/frontends/qt/GuiView.cpp
@@ -1967,9 +1967,20 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
 		enable = doc_buffer != 0;
 		break;
 
-	case LFUN_MASTER_BUFFER_FORALL:
-		enable = doc_buffer != 0;
+	case LFUN_MASTER_BUFFER_FORALL: {
+		if (doc_buffer == 0) {
+			flag.message(from_utf8(N_("Command not allowed without a buffer open")));
+			enable = false;
+		}
+		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")));
+			enable = false;
+		} else {
+			enable = true;
+		}
 		break;
+	}
 
 	case LFUN_BUFFER_WRITE:
 		enable = doc_buffer && (doc_buffer->isUnnamed() || !doc_buffer->isClean());


More information about the lyx-cvs mailing list