Martin Vermeer wrote:

> On Wed, 2006-03-22 at 23:19 -0600, Bo Peng wrote:
>> Dear list,
>> 
>> It does not look so difficult to implement this feature so I tried to
>> implement it by myself. Attached is my patch. Since I rarely submit a
>> patch here so I am afraid that there might be many problems (format,
>> logic, bugs). Please have a look and give me some feedbacks.
> 
> Format looks OK. The logic is a bit ad-hoc, but that comes with the
> territory.
> 
> Others may give detailed feedback on the code.
> 
>> Many files have been modified:
>> 
>> src/BufferView_pimpl.C
>> When a new buffer is loaded, it tries to get last cursor position from
>> ref().lastfiles(). When a file is going to be closed, current location
>> is saved as bookmark 0, and to ref().lastfiles(). A side effect of
>> this is that a file can be re-opened (and to the same location) from
>> bookmark 0.

I think that this is a very sensible approach. I would avoid to store this
information in the lyx file itself (privacy). Currently ezxchanging .lyx
files is safe because they don't carry aany hidden information, and I would
like it to stay like that.

>> 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?

I agree.

>> 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 should be explicitly handled after the file is read: Check for invalid
bookmarks, and delete them.

> This is a file format change and lyx2lyx must be made to handle it.

Why? I dont' see a format change.

>> 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.

I disagree. I once had to tutor a lab course where a program was used that
did strange things if it was closed via thw close button. It was very hard
to get the students used to that. IMO the close button should t=do exactly
the same as File->Quit. Everything else would confuse users.


Georg

Reply via email to