From: Enrico Forestieri Date: Fri, 6 Jun 2014 13:35:24 +0000 (+0200) Subject: Refine fix for bug #9151. X-Git-Tag: 2.2.0alpha1~1860 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=79dcf402b1fb64de7c6dfd2104a9496cdfe70230;p=lyx.git Refine fix for bug #9151. Now the cursor in LyX jumps to the right spot instead of simply the beginning of the paragraph. This is most useful for branch insets, for example, which may contain long paragraphs. --- diff --git a/src/BufferView.cpp b/src/BufferView.cpp index afc29be278..301fd2a002 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -2292,11 +2292,13 @@ 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 if (dit.depth() > 1) { - // We are an inset. + // We are in an inset. + pos_type lastpos = dit.lastpos(); + dit.pos() = tmppos > lastpos ? lastpos : tmppos; setCursor(dit); recenter(); return;