0

I'm having an Editor called Ultra Editor. In this editor i have created a file called "test.txt" with the contents of " This is Test Text ". I didn't close the ultra Editor Page. Now I opened this test.txt with the notepad Editor and changed the contents to "This is Test Text Welcome ! " and saved it with the same name. Now i moved my cursor to focus on Ultra Editor Window. Immediately the Ultra editor came up with the modified text. My Question is How this Ultra Editor knows the other editor modifying the File. How the Editor changed the file without any "Refresh" stuffs ?

Smith Dwayne
  • 2,675
  • 8
  • 46
  • 75

1 Answers1

1

It probably triggers some code to refresh the file from disk when you make it the foreground program. TextMate and MacVim have this behavior as well.

In windows one such event is Control.GotFocus. In OS X there's applicationDidBecomeActive.

nickgroenke
  • 1,472
  • 9
  • 12
  • There are more clever ways to monitor a filesystem, but the conclusion is correct. –  Jun 23 '12 at 05:58
  • Agreed. One complaint that I (and others) have about e.g. TextMate is that updates don't happen unless you tab out of the application and then back in. – nickgroenke Jun 23 '12 at 06:05