]> git.lyx.org Git - features.git/commitdiff
Disable CheckTeX while buffer is processed
authorJuergen Spitzmueller <spitz@lyx.org>
Sat, 10 Feb 2018 17:18:43 +0000 (18:18 +0100)
committerRichard Heck <rgheck@lyx.org>
Sat, 17 Mar 2018 19:44:05 +0000 (15:44 -0400)
Since CheckTeX itself processes the tex file, a synchronous run with
a TeX process can lead to all sorts of conflicts, including crashes.

Fixes: #7434.
(cherry picked from commit 71fea6332667e1a9fe99c38624e4dcaf1129d6c5)

lib/ui/stdmenus.inc
src/Buffer.cpp
src/frontends/qt4/GuiView.cpp

index 37c1067c98532e2c51d4f97e3652813219171a05..d1f145c8784577b91e18756e4ecbb6d8f07b4372 100644 (file)
@@ -594,7 +594,7 @@ Menuset
                Item "Spellchecker...|S" "dialog-show spellchecker"
                OptItem "Thesaurus...|T" "thesaurus-entry"
                Item "Statistics...|a" "statistics"
-               OptItem "Check TeX|h" "buffer-chktex"
+               Item "Check TeX|h" "buffer-chktex"
                Item "TeX Information|I" "dialog-show texinfo"
                Item "Compare...|C" "dialog-show compare"
                Separator
index cd49a683d79707f1785f86896ded7367d2bc0035..a8d1b2b718dca7bf116756631f964dc44bcae952 100644 (file)
@@ -2567,10 +2567,6 @@ bool Buffer::getStatus(FuncRequest const & cmd, FuncStatus & flag)
                break;
        }
 
-       case LFUN_BUFFER_CHKTEX:
-               enable = params().isLatex() && !lyxrc.chktex_command.empty();
-               break;
-
        case LFUN_BUILD_PROGRAM:
                enable = params().isExportable("program", false);
                break;
@@ -2682,10 +2678,6 @@ void Buffer::dispatch(FuncRequest const & func, DispatchResult & dr)
                break;
        }
 
-       case LFUN_BUFFER_CHKTEX:
-               runChktex();
-               break;
-
        case LFUN_BUFFER_EXPORT_CUSTOM: {
                string format_name;
                string command = split(argument, format_name, ' ');
index e511cd6cf7f887f00140267bf3583a63be168116..87260cb0d763a33ec6c30aab35acc995faea242f 100644 (file)
@@ -1941,6 +1941,19 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
                enable = theBufferList().last() != theBufferList().first();
                break;
 
+       case LFUN_BUFFER_CHKTEX: {
+               if (!doc_buffer || !doc_buffer->params().isLatex()
+                   || d.processing_thread_watcher_.isRunning()) {
+                       // grey out, don't hide
+                       enable = false;
+                       break;
+               }
+               // hide if we have no checktex command
+               enable = !lyxrc.chktex_command.empty();
+               flag.setUnknown(!enable);
+               break;
+       }
+
        case LFUN_VIEW_SPLIT:
                if (cmd.getArg(0) == "vertical")
                        enable = doc_buffer && (d.splitter_->count() == 1 ||
@@ -3800,6 +3813,11 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                        gotoNextOrPreviousBuffer(PREVBUFFER, true);
                        break;
 
+               case LFUN_BUFFER_CHKTEX:
+                       LASSERT(doc_buffer, break);
+                       doc_buffer->runChktex();
+                       break;
+
                case LFUN_COMMAND_EXECUTE: {
                        command_execute_ = true;
                        minibuffer_focus_ = true;