]> git.lyx.org Git - features.git/commitdiff
Fix bug #9151 (Wrong reverse search for images and tables).
authorEnrico Forestieri <forenr@lyx.org>
Sun, 3 Aug 2014 14:47:22 +0000 (16:47 +0200)
committerEnrico Forestieri <forenr@lyx.org>
Sun, 3 Aug 2014 14:47:22 +0000 (16:47 +0200)
If the reverse position corresponds to an inset, its paragraph id
does not follow the main text numbering. Typically, an inset has
only a few paragraphs, so that we would jump near the beginning of
the document. Now the cursor in LyX jumps to the right spot.

src/BufferView.cpp
status.21x

index ae3b640dc23cd7d311912f3f7185d96bca023b3f..324c65dff4393e841ef64740dbf2fc6f550839d3 100644 (file)
@@ -2290,10 +2290,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;
index 02b4cd83341e20baa7f7484be8ee2439b51d8fce..5f3fc6283ddce2377e6d135f3487ac49e5fbd697 100644 (file)
@@ -80,6 +80,8 @@ What's new
 
 - Fix listings validator with regard to aboveskip and belowskip (bug 7373).
 
+- Fix reverse search in insets (figures, tables, branches, etc.) (bug 9151).
+
 
 * INTERNALS