chrisbra / Recover.vim

A Plugin to show a diff, whenever recovering a buffer
http://www.vim.org/scripts/script.php?script_id=3068
248 stars 25 forks source link

Bug: Recover doesn't detect someone else editing same file #45

Closed Astara closed 7 years ago

Astara commented 7 years ago

If someone else is editing the same file, the Recover dialogue says that their is no change and defaults to the "Delete" option.

If someone is editing (the swap files PID is active), then shouldn't it default to 'Abort' ?

chrisbra commented 7 years ago

That's a theoretical problem, isn't it. If someone is editing the same file, the swapfile will be changed within a reasonable small time and then the plugin will detect this. Right?

Astara commented 7 years ago

Christian Brabandt wrote:

That's a theoretical problem, isn't it. If someone is editing the same file, the swapfile will be changed within a reasonable small time and then the plugin will detect this. Right?


Not at all. I work on my desktop logged into a development machine. Current project has about 50 C++ (.cc) files and a matching .h for each. If I work on the project over a few days, I often do so without closing any of the files. I'll update them -- often to remake the project to see if my changes are 'ok', but over time, I'll have 15-20 files minimized with only 1-2 w/open windows (or if I take a break and work on something else or read email or stuff, all will be minimized). When I get back to the project, it might be a few hours or the next day, so I'll restore (click on) the last file I was in. But now I definitely don't remember what files are open in an editor window and which are not. I'll usually look in my minimized windows before opening another edit, but not infrequently, I'll forget and re-open a file that is already open (but minimized).

I have lots of situations like the above.  Complicating things,

could be a desktop crash where I've re-opened the last few files I was working with, but don't go out of my way to try to open all of them, -- they just get opened as I want to look at them.

As a result, some will come up with swap files that came

from before the crash (and may be same or different), and some are already up but minimized in the new session.

So.. no I'm not trying to deal with "race" conditions not even

close -- just dealing with having many files open, many minimized, and then forgetting which of the 50+ files I might have open, but minimized.

Did that clarify the problem?

Thanks!

You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/chrisbra/Recover.vim/issues/45#issuecomment-286649534, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIwTfENCifckfbysOqOdb70xFtypdnPks5rl3-7gaJpZM4MdSC5.

chrisbra commented 7 years ago

ok. I made a slight modification. Can you check if that works better for you?

Astara commented 7 years ago

Just saw your comment... was taking a picture of situation on my desktop... will attach it to this ... vim-msg-dft-delete

You can see datasrc.h open in vim window on right. (far right is console window and did another edit of datasrc.h). That opens new window on left with the "Delete" option as the default (because the swap and file on disk are same) -- even though another gvim process (65559) has that file open.

p.s. will try new version asap