mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
Fix bug 3171: switching document jumps always back to last saved bookmark
http://bugzilla.lyx.org/show_bug.cgi?id=3171 * LyXFunc::closeBuffer(): remove code that is already done on Buffer deletion thanks to the Buffer::closing() signal connection to LyXView. Setting the Buffer twice was part of the reason of the bug. * BufferView::setBuffer(): properly update the metrics if we move to a saved cursor position. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18830 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3cf838c4d1
commit
608603a31d
@ -214,6 +214,12 @@ void BufferView::setBuffer(Buffer * b)
|
||||
cursor_.push(buffer_->inset());
|
||||
cursor_.resetAnchor();
|
||||
buffer_->text().setCurrentFont(cursor_);
|
||||
|
||||
// Update the metrics now that we have a proper Cursor.
|
||||
updateMetrics(false);
|
||||
|
||||
// FIXME: This code won't be needed once we switch to
|
||||
// "one Buffer" / "one BufferView".
|
||||
if (buffer_->getCursor().size() > 0 &&
|
||||
buffer_->getAnchor().size() > 0)
|
||||
{
|
||||
@ -227,12 +233,17 @@ void BufferView::setBuffer(Buffer * b)
|
||||
// Make sure that the restored cursor is not broken. This can happen for
|
||||
// example if this Buffer has been modified by another view.
|
||||
cursor_.fixIfBroken();
|
||||
|
||||
if (fitCursor())
|
||||
// Update the metrics if the cursor new position was off screen.
|
||||
updateMetrics(false);
|
||||
}
|
||||
updateMetrics(false);
|
||||
|
||||
if (graphics::Previews::status() != LyXRC::PREVIEW_OFF)
|
||||
graphics::Previews::get().generateBufferPreviews(*buffer_);
|
||||
}
|
||||
|
||||
|
||||
void BufferView::resize()
|
||||
{
|
||||
if (!buffer_)
|
||||
|
@ -2089,16 +2089,8 @@ void LyXFunc::closeBuffer()
|
||||
// goto bookmark to update bookmark pit.
|
||||
for (size_t i = 0; i < LyX::ref().session().bookmarks().size(); ++i)
|
||||
gotoBookmark(i+1, false, false);
|
||||
if (theBufferList().close(lyx_view_->buffer(), true) && !quitting) {
|
||||
if (theBufferList().empty()) {
|
||||
// need this otherwise SEGV may occur while
|
||||
// trying to set variables that don't exist
|
||||
// since there's no current buffer
|
||||
lyx_view_->getDialogs().hideBufferDependent();
|
||||
} else {
|
||||
lyx_view_->setBuffer(theBufferList().first());
|
||||
}
|
||||
}
|
||||
|
||||
theBufferList().close(lyx_view_->buffer(), true);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user