> > src/lastfiles.C:
> > I do not want to change the Files structure so I use a map to store
> > position information. lastfile format is changed to "<id, pos>
> > filename" if position information is available, and "filename" if not.
>
> Would it be easier to always have the <id, pos> filename format? And id
> = pos = 0 if no valid info exists, so current behaviour is reproduced?

With that I want to have a smooth transition to people that already
have a .lyx/lastfile. I is enough though, to always write in <>name
format, but also handle "name" when read.


> > 1. Will invalid paragraph id, pos crash lyx? I mean, if a file is
> > saved (with id, pos saved locally), and is modified externally (get a
> > revised copy from others), id, pos will no longer be valid and "goto
> > bookmark 0" will fail.
>
> This is a file format change and lyx2lyx must be made to handle it.

Is $HOME/.lyx/lastfile also handled by lyx2lyx?

> +        // not found, return invalid id number
> +       else {
> +               id = -1;
> +               pos = 0;
> +       }
>
> Please don't do this ;-)
>
> It won't be needed if we change and handle the new file format.

There is a problem with my current approach. LastFiles::readFile only
read num_files entries. If an older file is re-opened, the position
information will not be available. That is why I currently use this
'info not found' approach. It should be better to load all position
information regardless of num_files.


> > 2. Save position does not seem to work when I quit lyx by closing the
> > lyx window. Only close-buffer will do. Where should I handle the close
> > event?
>
> Don't bother. That's not the way to leave LyX.

Many people do this anyway.

> > 3. Is saved_positions[0] really unused?
>
> No, it's used in at least two other places.
>
> 1) To save the main document position to return to when opening a child
> 2) To save the return (ref) position when jumping to a label.
>
> Neither interferes with your use, I think.

That means the first menu entry will/should be disabled after such operations.

Bo

Reply via email to