Author Topic: force file reloading  (Read 5379 times)

Offline vix

  • Multiple posting newcomer
  • *
  • Posts: 60
force file reloading
« on: October 07, 2009, 02:49:03 pm »
Is there a command to force C::B reloading from disk an opened file?
I mean: if open a file, do some changes (without saving), then I realize I did something wrong, I'd like to reload the file from disk (discarding the pending changes). I usually close the opened file without saving, then reopen the same file from disk.
But is there a "reload" command?

Thank you very much.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: force file reloading
« Reply #1 on: October 07, 2009, 02:58:40 pm »
As far as I know, there is nothing like that.

But why do you not use the undo-function (shortcut ctrl+z).

Offline vix

  • Multiple posting newcomer
  • *
  • Posts: 60
Re: force file reloading
« Reply #2 on: October 07, 2009, 03:43:10 pm »
I think that undo function is an effective way only if you have done few modifications; If you have to press CTRL+Z 10 times or more (for example), It's not so good.

Moreover there is another situation I often experience, even if I think it's not so common.
Imagine you are debugging a project that writes its output over a txt file, and you like watching this file inside C::B (because you are debugging using C::B). You open this file, but while program executes, additional informations are added to this file. If you can update the view of the file content simply with a shortcut (F5 key as in some browsers, for example) you will be very happy... I think

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: force file reloading
« Reply #3 on: October 07, 2009, 04:31:35 pm »
1. C::B is not a browser, but IDE/editor, and no editor I know does this
2. The files is monitored for modifications and a message pops up, when such thing happens
3. What if you have autosave enabled?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline daniloz

  • Regular
  • ***
  • Posts: 268
Re: force file reloading
« Reply #4 on: October 07, 2009, 09:33:56 pm »
I'd like to have this functionality as well... my comments:

Quote
1. C::B is not a browser, but IDE/editor, and no editor I know does this

Notepad++ does... it has a reload functionality (which I map to F5, btw)

Quote
2. The files is monitored for modifications and a message pops up, when such thing happens

Very seldom, C::B miss some modifications though... I've experienced it once or twice, since I use another IDE in parallel for compilation (VisualDSP++ from Analog Devices to compile for a SHARC DSP)

Quote
3. What if you have autosave enabled?

Then , it should reload the last saved version and it's up to the user handle this issue...

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: force file reloading
« Reply #5 on: October 07, 2009, 10:01:14 pm »
It would possibly make sense to force a check for modification outside the IDE, but not do a silent reload.

If I see it right,C::B only checks for modified files, if one of the "New"-submenus was called, the app gets (re-)activated or we swap between header and sourcefile.

Reloading a file without asking would irreversible delete all changes that have been made, because the undo-history would also be cleared.

Ctrl-z is enought to revert also very many changes, just keep the keys pressed and it will revert everything until the point the undo-buffer was cleared the last time.
That (the undu-buffer-clearing) happens in three cases: a file gets (re-)loaded, you switch changebar on, if it wasn't, or you clear the buffer explicitely via the (context-)menu.

And that also works if you have saved the file after opening it, as it always happens when the newly added code was compiled to test it.

So a menu-entry to force a check for modified files would make sense in my eyes (at least for files that get changed by the program, that the user works on, egally if that happens for debugging purposes or anything else), but a force-file-reload is not only unnecessary, but can be really dangerous, because it might lead to data-loss.

Offline daniloz

  • Regular
  • ***
  • Posts: 268
Re: force file reloading
« Reply #6 on: October 07, 2009, 11:31:24 pm »
Quote
So a menu-entry to force a check for modified files ...

That's what I meant... (and want :-) )