Update previews when going to a bookmark (#6173)

Note that I move the definition of cur up because we need to check if
it changed before the return. I also removed the const because
notifyCursorLeavesOrEnters() requires that.

This commit probably fixes other issues for any inset that defines
notifyCursorLeaves().

This fixes only part of #6173.
This commit is contained in:
Scott Kostyshak 2015-04-21 21:11:17 -04:00
parent 72838f24b9
commit ae14d8fe34

View File

@ -1438,6 +1438,7 @@ void GuiApplication::gotoBookmark(unsigned int idx, bool openFile,
// if the current buffer is not that one, switch to it.
BufferView * doc_bv = current_view_ ?
current_view_->documentBufferView() : 0;
Cursor const old = doc_bv->cursor();
if (!doc_bv || doc_bv->buffer().fileName() != tmp.filename) {
if (switchToBuffer) {
dispatch(FuncRequest(LFUN_BUFFER_SWITCH, file));
@ -1453,12 +1454,15 @@ void GuiApplication::gotoBookmark(unsigned int idx, bool openFile,
tmp.bottom_pit, tmp.bottom_pos, tmp.top_id, tmp.top_pos))
return;
Cursor & cur = doc_bv->cursor();
if (cur != old)
notifyCursorLeavesOrEnters(old, cur);
// bm changed
if (idx == 0)
return;
// Cursor jump succeeded!
Cursor const & cur = doc_bv->cursor();
pit_type new_pit = cur.pit();
pos_type new_pos = cur.pos();
int new_id = cur.paragraph().id();