Author Topic: Modified status when underlying file has changed but buffer hasn't  (Read 1509 times)

jc44

  • Senior Community Member
  • Posts: 329
  • Hero Points: 22
Modified status when underlying file has changed but buffer hasn't
« on: September 24, 2020, 10:41:02 AM »
[Beta 4, Win 10 x64, Brief] If I accidentally (doh!) re-checkout a file outside SE then when I return to SE it correctly asks me if I want to reload it.  If I decline, and my buffer was previously clean (un-modified), then it remains unmodified.  This means that I cannot save the file by simply hitting (brief)Alt-W as SE thinks it is unmodified and I would be allowed to exit without prompt.  Surely it would be more logical to mark the buffer as modified as it no longer corresponds to the file on disk?
I really doubt this is new behaviour but I've just been caught by it.

[a bit later] Actually I now find that if I've cancelled the reload I get asked about it every time I swap focus away from and back to SE even if the file hasn't changed again.  This seems wrong.
« Last Edit: September 24, 2020, 10:46:55 AM by jc44 »

Dan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2896
  • Hero Points: 153
Re: Modified status when underlying file has changed but buffer hasn't
« Reply #1 on: September 24, 2020, 01:13:05 PM »
Can you just modify the file by pressing space, then backspace, and save it then?

jc44

  • Senior Community Member
  • Posts: 329
  • Hero Points: 22
Re: Modified status when underlying file has changed but buffer hasn't
« Reply #2 on: September 24, 2020, 01:20:57 PM »
Yeah that works fine & it is what I do as a workaround, but the lack of indication that the buffer doesn't match the file is confusing (both for me & SE).

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6823
  • Hero Points: 526
Re: Modified status when underlying file has changed but buffer hasn't
« Reply #3 on: September 24, 2020, 01:24:00 PM »
Actually I now find that if I've cancelled the reload I get asked about it every time I swap focus away from and back to SE even if the file hasn't changed again.  This seems wrong.
This could be an option. I've accidentally pressed ESC on the reload dialog a ton of times. Sometimes I realize I did this and switch away from SlickEdit and switch back to see if I missed a reload (like after git pull).

Saving the file is a good work around.
« Last Edit: September 24, 2020, 01:28:16 PM by Clark »

Dan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2896
  • Hero Points: 153
Re: Modified status when underlying file has changed but buffer hasn't
« Reply #4 on: September 24, 2020, 01:26:03 PM »
Auto reload creates a backup in Backup History.  So you should be able to let it reload, and then go to File>Backup History for the file and copy from the previous version.  Only if you are using "Backup history on save" as your backup style.

jc44

  • Senior Community Member
  • Posts: 329
  • Hero Points: 22
Re: Modified status when underlying file has changed but buffer hasn't
« Reply #5 on: September 24, 2020, 01:44:12 PM »
In the current world I can see that switch away & back to check whether stuff has changed is a valid use but it does feel like this is making a virtue out of slightly dodgy behaviour due to the fact that this is the only way of checking this.

What is the downside to marking a buffer as modified if the underlying file changes? (I suspect there are some but I can't see them immediately.)

Dan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2896
  • Hero Points: 153
Re: Modified status when underlying file has changed but buffer hasn't
« Reply #6 on: September 24, 2020, 01:59:19 PM »
If you try to save over a newer file, SlickEdit will warn you.  Saving over a newer file, maybe if you saved from a debugger, is the only thing I can think of.  But SlickEdit would warn you in that case.  In this particular case, you know you want to save over the newer file, so I cannot think of anything right now.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6823
  • Hero Points: 526
Re: Modified status when underlying file has changed but buffer hasn't
« Reply #7 on: September 24, 2020, 02:03:59 PM »
In the current world I can see that switch away & back to check whether stuff has changed is a valid use but it does feel like this is making a virtue out of slightly dodgy behaviour due to the fact that this is the only way of checking this.

What is the downside to marking a buffer as modified if the underlying file changes? (I suspect there are some but I can't see them immediately.)

Seems reasonable as long as it's an option. Not sure if everyone would like this. It might make me believe my file in SlickEdit is newer than the file on disk. Like Dan said, SlickEdit would prompt you when saving the file which might help you figure this out.

Seems like there could be a couple options (Only prompt once to reload a file, Set modify if don't reload file).

jc44

  • Senior Community Member
  • Posts: 329
  • Hero Points: 22
Re: Modified status when underlying file has changed but buffer hasn't
« Reply #8 on: September 24, 2020, 02:36:16 PM »
If it was possible to have another status indicator for "original file changed - not by SE" (say "~") as well as the "buffer modified" status "*" that would do everything.  Have tab colouration (by default) be for buffer != file so you know what you need to save for your compile to match your edit?

Either way saving is currently confusing in the current world if I do not reload a modified file (Brief):
Alt-W (write buffer which is what I normally use to save a single file) does nothing
Save / Shift-F12 writes the buffer over the file
"Save all" does nothing
"Close SE" / Alt-F4 exits without prompt


Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6823
  • Hero Points: 526
Re: Modified status when underlying file has changed but buffer hasn't
« Reply #9 on: September 24, 2020, 02:38:38 PM »
You could use the "save" command instead of the "brief_save" command. The brief_save command won't save the file unless it's modified.