Re: Saving file position in mcedit



Pavel Roskin wrote:
Hello!

I have tried the patch for saving file position, and indeed it seems very convenient. I think it should be in 4.6.0.

I'm doing minor cleanups now.  In particular, I changed
edit_move_to_column() to be much more effective (current patch is attached
for the curious).

There is one question I want to ask.  What if we save the positions for
the device and inode combinations, rather than for filenames?  Device and
inode numbers are part of the stat structure, and they are unique for
every file.  They also survive renames.  mc already calls stat(), so we
have the required data already.

On the positive side we have less manipulations with strings in the code
(in fact, the file with positions can just be a binary) and the ability to
rename files and whole directories without losing saved positions for all
files.

On the negative side, it is harder to edit the file with positions, e.g. to hide the fact that you were editing certain files. I don't think it's
important.  You can always erase the whole file to hide evidence.

Any other reasons to tie positions to full filenames?

Ok, let we choose Safe save or Do backups in the editor.
Now editor rename original file to someting else and then creates new file and stores edited file there. New version has new dev/inode combination and saved position are useless.

There is one more reason to use full filenames (or even realpath) in editor always. If you change working directory and filename is not absolute then editor will save this file relative new working directory. Of course, user should see names s/he give to editor. It was the main inconsistensy in the Wallery Studennikov multi-screen patche as for me.


--
Regards,
Andrew V. Samoilov






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]