Additionally the throttling has been improved. Previously we would delay a status fetch if it had been less than 3 seconds since the last request, but during this “penalty wait” more requests could still be submitted (in case of disk activity) and would be queued for later execution — now such requests are dropped.
When we quit, objects with static storage are destroyed. Since the order is undefined, we basically cannot reference other objects in destructors, unless we own them or they are reference counted.
One case that seems to be an actual problem is the oak::process_t type — based on crash logs this often seems to be destroyed last, and it unregisters itself in its destructor, but using an object that it previously did not own (but obtained via a sort of factory function).
The issue this code solved was that setting the proxy icon via represented file before a file actually exists on disk would lead to no icon so we would have to update it again after a successful save.
This however is already done (by the save callback passed in).
We first search for a window containing one of the documents we wish to open, then for the window with a best match for project folder (for any of our documents), then check if frontmost window is a scratch window, and if none of the above gives a candidate, we create a new window (and give it a project folder based on the document(s) we opened).
Removed the ability to specify wether documents should open in current window or a new window — all documents opened via this API will go through the same algorithm to find where the documents should end up (more choice is just adding confusion and complexity).
It didn’t really make sense as an instance method since it iterate all instances, and we also want to execute code incase of no instances (save that fact as session data).
Since everything about session is now contained in the DocumentController class there is no need for invoking this from elsewhere and thus no need for the previous indirection.
Instead we register the class (causing a retain) when setting the object’s identifier (to a non-nil value).
This is a much better design as it (again) makes it safe to just instantiate a document controller w/o going through a special factory method. Additionally it makes it safe to change the identifier of an already created (and registered) instance.
Previously we would render these with their code point value but since there are probably a few hundred glyphs available (on OS X) in the private use area, it was a disputed choice.
While I have tried to keep most of the functionality the same (to get functional changes spelled out in the commit history) there are some significant changes:
When you open a folder or document(s) a default project folder will be based on the path(s) opened. This means that as long as you always open the root of your project (via `mate`, `open -a TextMate`, dragging the folder to TextMate, using the favorites (⇧⌘O), open dialog, `txmt:` URL scheme, or what have you), your project no longer require a `.tm_properties` file setting `projectDirectory` for Find in Folder (⇧⌘T), Go to File (⌘T), and similar to work as desired. Additionally the default properties now set a window title that include the project folder’s name (and SCM branch when available), so most projects can now also drop setting `windowTitle`.
Furthermore the file browser (for when opening documents) will default to the project folder rather than the folder set in Preferences (the latter is still used if there is no document, e.g. after ⌘N or ⌃⌘N).
The default project folder, even for opening a single document, means that opening more documents from the same folder (via Finder or perhaps something that uses the same temp folder for the local versions (which `rmate` does)) means that the following documents will open as tabs in the already open window (containing the first one opened). I _think_ this takes care of the common request of having all documents opened appear in new tabs of the frontmost window.
For managing tabs the ‘Merge All Windows’ action now ignores minimized windows. This means that if you wish to only merge a few windows then you can minimize all but those you wish to merge and then perform the action.
This commit should also address issue #117 (closing window’s last document via the file browser closes the entire window). Canceling a file open also no longer causes the entire window to close, but there’s still some work to do in this department (actually backtracking to previous state, which could mean closing the window if the window was opened only to show this document).
Prior to this commit the tab bar would be automatically pruned when overflowing, this is no longer the case, though this functionality should return.
Previously we would let NSURL parse the parameter and ask for the path component. This however does not support tilde as shorthand for the user’s home directory, and certainly not with TextMate 1.x’s questionable syntax (using ‘file://~/«file»’ instead of ‘file://localhost/~/«file»’ or possibly ‘file:///~/«file»’ although this one seems a little wrong).
As for percent escapes, the issue here is that if the URL parameter escapes slashes or colons, not decoding the URL parameter before creating an NSURL instance will fail (as the URL is malformed). If however we do decode percent escapes and the URL parameter contains spaces, then NSURL will also fail, as a URL with spaces is malformed.
So I ended up bypassing NSURL and check for a few variants of a ‘file://’ prefix (which is also what TextMate 1.x did).
This closes issue #602.
This is only if the project directory is actually set at the time the default properties are expanded, so presently this has no effect (but will when TextMate sets a default value for the projectDirectory variable).
This can be used to link to the “current document” even if that document has no path. Previously this was done by leaving out the ‘url’ parameter, which made it target the frontmost document — using ‘uuid’ is a more robust way to achieve the same.
A command can read the TM_DOCUMENT_UUID environment variable for the current document’s identifier.
Previously if the custom name was set before the display name was requested, it would not allocate an untitled counter, but if set later, it would (effectively) not release the counter already allocated.
We may use OakDocumentView in a context where we don’t immediately assign it a document, or we wish to “overwrite” its default document with an untitled document that we create.
If the document view holds its own untitled document then the global counter includes that and the one we create is one higher than expected.
Previously this was undefined, yet some code could trigger it. E.g. asking for the OS dictionary pop-up with an empty document.
I wasn’t sure if this should actually be allowed but decided that since operator[] returns strings, the “end of buffer” code point is easily defined as an empty string makes the code using this API simpler.
We regularly iterate through all open windows and test if these are document controller windows. It will be easier to let the document controller class (or application delegate) manage a list of open document windows, as we anyway need some sort of owner with ARC (currently the instances own themselves and give up ownership in windowWillClose: which cause them to be released).