]> git.lyx.org Git - lyx.git/blobdiff - src/session.C
Fix encoding of converters path and arguments
[lyx.git] / src / session.C
index 8ecbb5255dae7cfd18195a89f38556040971d619..fd2f26a7fc2a8044c49e28374b09a16ed1a6a3a3 100644 (file)
@@ -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();
 }