X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsession.C;h=fd2f26a7fc2a8044c49e28374b09a16ed1a6a3a3;hb=b9aa557b359463dfb0a2132b665570c8d1e5d605;hp=8ecbb5255dae7cfd18195a89f38556040971d619;hpb=ed99f752f9b4ce52cf55cac2a94658fb087c7383;p=lyx.git diff --git a/src/session.C b/src/session.C index 8ecbb5255d..fd2f26a7fc 100644 --- a/src/session.C +++ b/src/session.C @@ -184,7 +184,7 @@ void LastFilePosSection::read(istream & is) itmp.ignore(2); // ignore ", " itmp >> pos; itmp.ignore(2); // ignore ", " - itmp >> fname; + getline(itmp, fname); if (!absolutePath(fname)) continue; FileName const file(fname); @@ -244,16 +244,16 @@ void BookmarksSection::read(istream & is) try { // read bookmarks - // id, pos, file\n - unsigned int id; + // pit, pos, file\n + pit_type pit; pos_type pos; string fname; istringstream itmp(tmp); - itmp >> id; + itmp >> pit; itmp.ignore(2); // ignore ", " itmp >> pos; itmp.ignore(2); // ignore ", " - itmp >> fname; + getline(itmp, fname); if (!absolutePath(fname)) continue; FileName const file(fname); @@ -261,7 +261,7 @@ void BookmarksSection::read(istream & is) if (fs::exists(file.toFilesystemEncoding()) && !fs::is_directory(file.toFilesystemEncoding()) && bookmarks.size() < max_bookmarks) - bookmarks.push_back(Bookmark(file, id, pos)); + bookmarks.push_back(Bookmark(file, pit, 0, pos)); else lyxerr[Debug::INIT] << "LyX: Warning: Ignore bookmark of file: " << fname << endl; } catch (...) { @@ -275,29 +275,31 @@ void BookmarksSection::write(ostream & os) const { os << '\n' << sec_bookmarks << '\n'; for (size_t i = 0; i < bookmarks.size(); ++i) { - os << bookmarks[i].par_id << ", " + os << bookmarks[i].par_pit << ", " << bookmarks[i].par_pos << ", " << bookmarks[i].filename << '\n'; } } -void BookmarksSection::save(FileName const & fname, int par_id, pos_type par_pos, bool persistent) +void BookmarksSection::save(FileName const & fname, pit_type par_pit, int par_id, pos_type par_pos, bool persistent) { if (persistent) { - bookmarks.push_front(Bookmark(fname, par_id, par_pos)); + bookmarks.push_back(Bookmark(fname, par_pit, par_id, par_pos)); if (bookmarks.size() > max_bookmarks) bookmarks.pop_back(); } else - temp_bookmark = Bookmark(fname, par_id, par_pos); + temp_bookmark = Bookmark(fname, par_pit, par_id, par_pos); } bool BookmarksSection::isValid(unsigned int i) const { - // i == 0, or in the queue - return i <= bookmarks.size(); + if (i == 0) + return !temp_bookmark.filename.empty(); + else + return i <= bookmarks.size() && !bookmarks[i-1].filename.empty(); }