"Bo Peng" <[EMAIL PROTECTED]> writes: | 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. | | 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 am not sure if I like lastfiles to be the files that store this info. One of the reason is that we only store a very limited number of files there... lastpostion info should hold more files. I'd prefere if there was a separate file for this information. bookmark0? where is that stored? if it in the lyx document, then please no. Also I think bookmarks and lastplace should be kept a part and not be connected at all. | 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. | The biggest changes are to read/write lastfile. I hope that I have not | broken anything here. With a new file with its own format, this is not a problem. Also please have a look at how emacs does this. (.emacs-places) | src/lyxfunc.C: | save cursor position when the buffer is closed. | | lib/ui/stdmenus.ui: | add a menu item with an awkard name. What do you need the menuitem for? | I am worrying about two problem though: | | 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. Please do not use paragraph id it is not stable. Perhaps use the cursor stack info instead. | 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? That would be a more general bug. | 3. Is saved_positions[0] really unused? Where is it found? -- Lgb