]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.cpp
Support new languages in tex2lyx
[lyx.git] / src / BufferView.cpp
index ba0df6ef5f8892d51eacb3b7a6d47d6862954299..301fd2a002b770f2ccee7f80757b6e125cb93713 100644 (file)
@@ -2292,10 +2292,17 @@ void BufferView::setCursorFromRow(int row)
                // we need to make sure that the row and position
                // we got back are valid, because the buffer may well
                // have changed since we last generated the LaTeX.
-               DocIterator const dit = buffer_.getParFromID(tmpid);
+               DocIterator dit = buffer_.getParFromID(tmpid);
                if (dit == doc_iterator_end(&buffer_))
                        posvalid = false;
-               else {
+               else if (dit.depth() > 1) {
+                       // We are in an inset.
+                       pos_type lastpos = dit.lastpos();
+                       dit.pos() = tmppos > lastpos ? lastpos : tmppos;
+                       setCursor(dit);
+                       recenter();
+                       return;
+               } else {
                        newpit = dit.pit();
                        // now have to check pos.
                        newpos = tmppos;