]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.cpp
Do not crash when entering math in ct mode with merge dialog open.
[lyx.git] / src / BufferView.cpp
index ab5501cdb629a020918fb73b245f505e97d0c410..392f380f1d248f729e23e1e08339cb5d3ff74829 100644 (file)
@@ -686,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());
 }
 
@@ -2499,7 +2503,7 @@ void BufferView::putSelectionAt(DocIterator const & cur,
 bool BufferView::selectIfEmpty(DocIterator & cur)
 {
        if ((cur.inTexted() && !cur.paragraph().empty())
-           || cur.inMathed() && !cur.cell().empty())
+           || (cur.inMathed() && !cur.cell().empty()))
                return false;
 
        pit_type const beg_pit = cur.pit();