Yes: dispatch(FuncRequest(LFUN_BUFFER_SWITCH, _name_of_the_buffer))
No. BufferBiew::dispatch() does not pass the signal to LyXView. Will something like attached be accepted? Basically, I move LFUN_BOOKMARK_GOTO to lyxfunc.C and swith buffer via LyxView instead of BufferView. A relocation of the whole bookmark feature may worth further consideration though. How to test: Open two documents, save bookmark, switch to another document, go to saved bookmark. Currently, buffer switches without window title (and other) change. The attached patch seems to fix this. Abdel: is this something you can fix? Open lyx, load a document, save bookmark, open another window, bookmarks are disabled. I thik even if 'save bookmark' does not work without a buffer, "goto bookmark" should, when a valid bookmark exists. Index: src/lyxfunc.C =================================================================== --- src/lyxfunc.C (revision 15595) +++ src/lyxfunc.C (working copy) @@ -1660,6 +1660,16 @@ // We return here because lyx_view does not exists anymore. return; + case LFUN_BOOKMARK_GOTO: { + unsigned int id = convert<unsigned int>(to_utf8(cmd.argument())); + string const & fname = view()->filenameOfSavedPosition(id); + if (lyx_view_->buffer()->fileName() != fname) + dispatch(FuncRequest(LFUN_BUFFER_SWITCH, fname)); + // now, we restore cursor location + view()->restorePosition(id); + break; + } + default: { BOOST_ASSERT(lyx_view_); view()->cursor().dispatch(cmd); Index: src/BufferView.C =================================================================== --- src/BufferView.C (revision 15595) +++ src/BufferView.C (working copy) @@ -533,22 +533,10 @@ if (i >= saved_positions_num) return; - string const fname = saved_positions[i].filename; - cursor_.clearSelection(); - if (fname != buffer_->fileName()) { - Buffer * b = 0; - if (theBufferList().exists(fname)) - b = theBufferList().getBuffer(fname); - else { - b = theBufferList().newBuffer(fname); - // Don't ask, just load it - lyx::loadLyXFile(b, fname); - } - if (b) - setBuffer(b); - } + // LFUN_BOOKMARK_GOTO should have switched buffer + BOOST_ASSERT(saved_positions[i].filename == buffer_->fileName()); ParIterator par = buffer_->getParFromID(saved_positions[i].par_id); if (par == buffer_->par_iterator_end()) @@ -561,6 +549,13 @@ message(bformat(_("Moved to bookmark %1$d"), i)); } +string const & BufferView::filenameOfSavedPosition(unsigned int i) +{ + if(isSavedPosition(i)) + return saved_positions[i].filename; + else + return string(); +} bool BufferView::isSavedPosition(unsigned int i) { @@ -763,10 +758,6 @@ savePosition(convert<unsigned int>(to_utf8(cmd.argument()))); break; - case LFUN_BOOKMARK_GOTO: - restorePosition(convert<unsigned int>(to_utf8(cmd.argument()))); - break; - case LFUN_LABEL_GOTO: { docstring label = cmd.argument(); if (label.empty()) { Index: src/BufferView.h =================================================================== --- src/BufferView.h (revision 15595) +++ src/BufferView.h (working copy) @@ -106,6 +106,8 @@ void savePosition(unsigned int i); /// Restore the position from bookmark i void restorePosition(unsigned int i); + /// + std::string const & filenameOfSavedPosition(unsigned int i); /// does the given bookmark have a saved position ? bool isSavedPosition(unsigned int i); /// save bookmarks to .lyx/session