commit ae14d8fe343ea3df5e56f9b5f1065aa94a9ee3da
Author: Scott Kostyshak <skost...@lyx.org>
Date:   Tue Apr 21 21:11:17 2015 -0400

    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.

diff --git a/src/frontends/qt4/GuiApplication.cpp 
b/src/frontends/qt4/GuiApplication.cpp
index 94c6346..4822e59 100644
--- a/src/frontends/qt4/GuiApplication.cpp
+++ b/src/frontends/qt4/GuiApplication.cpp
@@ -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();

Reply via email to