]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.cpp
Turn an error message into a Debug::LOCALE warning
[lyx.git] / src / BufferView.cpp
index 435a806f06f0cf162f65ddb8fd0fd6d2eecb79bb..ba0df6ef5f8892d51eacb3b7a6d47d6862954299 100644 (file)
@@ -62,6 +62,8 @@
 #include "insets/InsetRef.h"
 #include "insets/InsetText.h"
 
+#include "mathed/MathData.h"
+
 #include "frontends/alert.h"
 #include "frontends/Application.h"
 #include "frontends/Delegates.h"
@@ -684,6 +686,10 @@ Change const BufferView::getCurrentChange() const
                return Change(Change::UNCHANGED);
 
        DocIterator dit = d->cursor_.selectionBegin();
+       // The selected content might have been changed (see #7685)
+       while (dit.inMathed())
+               // Find enclosing text cursor
+               dit.pop_back();
        return dit.paragraph().lookupChange(dit.pos());
 }
 
@@ -1102,12 +1108,12 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
 
        case LFUN_CHANGES_TRACK:
                flag.setEnabled(true);
-               flag.setOnOff(buffer_.params().trackChanges);
+               flag.setOnOff(buffer_.params().track_changes);
                break;
 
        case LFUN_CHANGES_OUTPUT:
                flag.setEnabled(true);
-               flag.setOnOff(buffer_.params().outputChanges);
+               flag.setOnOff(buffer_.params().output_changes);
                break;
 
        case LFUN_CHANGES_MERGE:
@@ -1424,12 +1430,12 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
        }
 
        case LFUN_CHANGES_TRACK:
-               buffer_.params().trackChanges = !buffer_.params().trackChanges;
+               buffer_.params().track_changes = !buffer_.params().track_changes;
                break;
 
        case LFUN_CHANGES_OUTPUT:
-               buffer_.params().outputChanges = !buffer_.params().outputChanges;
-               if (buffer_.params().outputChanges) {
+               buffer_.params().output_changes = !buffer_.params().output_changes;
+               if (buffer_.params().output_changes) {
                        bool dvipost    = LaTeXFeatures::isAvailable("dvipost");
                        bool xcolorulem = LaTeXFeatures::isAvailable("ulem") &&
                                          LaTeXFeatures::isAvailable("xcolor");
@@ -2496,7 +2502,8 @@ void BufferView::putSelectionAt(DocIterator const & cur,
 
 bool BufferView::selectIfEmpty(DocIterator & cur)
 {
-       if (!cur.paragraph().empty())
+       if ((cur.inTexted() && !cur.paragraph().empty())
+           || (cur.inMathed() && !cur.cell().empty()))
                return false;
 
        pit_type const beg_pit = cur.pit();