"Bo Peng" <[EMAIL PROTECTED]> writes: | Index: src/BufferView_pimpl.C | =================================================================== | --- src/BufferView_pimpl.C (revision 13463) | +++ src/BufferView_pimpl.C (working copy) | @@ -293,6 +293,20 @@ | | setBuffer(b); | bv_->showErrorList(_("Parse")); | + | + // scroll to the position when the file was last closed | + // FIXME: this "if(true)" should be changed to a rcfile switch | + // I do not know how to do it now. | + if( true ) { | + std::pair<lyx::pit_type, lyx::pos_type> pos = LyX::ref().lastfiles().loadFilePosition(s);
Alternatively, more similar to what you had earlier: int pit; int pos; boost::tie(pit, pos) = LyX::ref().lastfiles().loadFilePosition(s); | + // p.get<0> is pit, need to translate it to paragraph id. pos.first | + ParagraphList& prghs = b->paragraphs(); | + // be careful since the file may have been externally changed ... | + if ( pos.first < prghs.size() ) { | + saved_positions[0] = Position(s, prghs[pos.first].id(), pos.second); | + restorePosition(0); | + } | + } Can you please drop the bookmark part of the patch for now? If we decide that we do want bookmark[0] to be the position the cursor was in when the doc was last saved we can put this in later. (but... I just realized that you rely on this in your implementation... hmm) We actually want to get rid of the whole paragraph.id thing. It is not stable enough. I have some (vague) plans of introducing a (universally) unique id to use on paragraphs. Just as a test... load a document move the cursor save. Exit lyx. Start lyx. Load a different document. Load the first doc. Where is the cursor placed now? | Index: src/lastfiles.C Doesn't this almost double the size of lastfiles.C? (I am just trying to prove that code complexity is not reduced it IMNO increases a lot.) Note that despite all my negativism I am super happy that you have picked up this ball. This is a feature I have wanted for a long time, but have never found the time to implement. -- Lgb