Previously calling the function with invalid UTF-8 could cause it to iterate over all the data and, if built in debug mode, could cause an assertion failure.
Now we return the sequence’s end when the data appears to be malformed and we never look at more than the last 6 bytes in the sequence.
This is generally desired when the indent of a new line does not (necessarily) depend on lines above it, but where we otherwise do want indent corrections, e.g. HTML.
Previously only the most specialized callback(s) would run. For example creating a command scoped to “source” with “callback.document.will-save” for semantic class would never run for Ruby, Python, etc. because the Source bundle has a “Make Script Executable” callback scoped specifically to “source.ruby”, “source.python”, etc.
Instead we date stamp each entry and do a sorted fetch (with a limit of one) to find next/previous entry (when required).
The reason for moving away from an ordered collection is twofold, the main reason is that NSArrayController does not support ordered collections, so we lose one of the advantages of switching to CoreData. The secondary reason is that using an ordered collection requires that we use an index for “current item” (or maybe liberal use of indexOfObject:) and it’s problematic to ensure that the index is kept 100% in sync with the entries in the collection (especially with bindings and delayed actions).
If an exception is thrown, a dialog is shown. This isn’t very user friendly, but the goal is to call attention to the problem, as I wouldn’t expect any exceptions to be thrown by this method, but I have seen multiple “optimistic locking failure” exceptions despite single-app / single-thread access to the persistent store.
This is required for showing SCM status for “Open Files”. Previously, closing the file chooser with “Open Files” selected and re-opening it, would not have SCM info for the open files.
This is only done for code where running it twice would actually cause a problem.
Dispatch_once is favored over a static boolean only because it seems to carry slightly more semantic information.
For example in ruby inserting ‘env⇥’, deleting the initially selected letter, and typing B or S, would insert an additional caret (it was actually inserted in the previous step, but not visible since it was overlapping the existing caret).
The API lack proper support for returning the new caret range so we are using a heuristic to figure out which of the returned ranges correspond to our caret. Ideally the API would be updated.
Instead we access it when either we need to submit a crash report, when the preferences window open (where the contact address is shown), or when creating a new bundle (where email is also used for the bundle’s contact).
Previously we would fallback on the grammar’s folding patterns unless ‘foldingStartMarker’ was set, which meant setting just the stop marker or indented folding patterns, would be ignored.
Since we save the history during applicationWillTerminate: there is (in theory) no reason to periodically save the history, but in case of a crash or similar, we would not get to applicationWillTerminate:.
Previously we would only record it if the user invoked a replace action from the find dialog, but the user may invoke “find” from the dialog and then subsequently “replace” via keyboard/menu (where we would not record the string).
Since we treat a missing key as having the value ‘false’ there is no need to write out keys set to false. This was partly motivated by improving cached data since here we store non-strings as binary property lists, and boolean values are non-strings (not that we have that many keys set to false, but it would e.g. happen if user disable an item and later enable it).
When we see a changed item we drop it from the cache and mark the cache as “incomplete”, indicating that the bundle index should be rebuilt, which in turn causes all known items to be fetched, and the cache will thereby reload the updated entries.
However, when replaying fs-events, we are in a “rebuild index” state and would not re-rebuild the index incase items were dropped.
For example if at column 60 on a line and moving up/down to a shorter line, we remember that column 60 is our desired column position. This would previously be used when returning a position for the caret, e.g. used with clipboard history pop-ups and bundle item disambiguation menus.
Previously this was stored in NSUserDefaults. The problem with that approach is that if large items were stored in the history, it would cause slowdowns, presumably by periodic writing the entire user defaults to disk.