]> git.lyx.org Git - features.git/commitdiff
Update previews when going to a bookmark (#6173)
authorScott Kostyshak <skostysh@lyx.org>
Wed, 22 Apr 2015 01:11:17 +0000 (21:11 -0400)
committerScott Kostyshak <skostysh@lyx.org>
Sun, 26 Apr 2015 00:01:39 +0000 (20:01 -0400)
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.

src/frontends/qt4/GuiApplication.cpp

index 94c63461c106aadb5b07053bd6e1917847582882..4822e59967c132c63fa4f218c0721f6347d0f8d2 100644 (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();