This is a continued effort to track down the crash mentioned in commit 45fdb380ea.
In retrospect, the previous commit didn’t fix anything, as the temporary string object should be valid until the function has returned and there has been a few crash reports listing the function, though the frequency seems to have been decreased dramatically.
When we wish to (ab)use the indented fold system to fold sections in markup languages we set the ignore pattern to ignore all but the heading markers. Some markup languages also have markup that might be suitable for folding with explicit start/stop markers, previously these were ignored, if matched by the ignore pattern.
This is an incomplete fix as we don’t correctly nest a start/stop marked block inside a section (the section will stop at the fold start marker).
Since documents are loaded asynchronously and we trigger a request for the first tab’s document, this might finish loading after the selected tab’s document, hence trigger a setDocument: after we loaded the selected document’s tab.
These are based on the potential save directory (i.e. the one showing in the file browser) and ensures pressing ⌥⌘N gives the new document proper project and SCM scopes (so ⌘Y and ⌘B works as expected).
This fixes issue #367.
We didn’t actually use the file itself, only its parent directory, and there are several places we want SCM info for an untitled file’s project directory, so removing the need for a file simplifies things.
The refresh helper uses the document’s undo manager in its destructor. Normally the document would stay open throughout the duration of the scope in which the refresh helper is used, but it might be possible to close the current document from a nested event loop, as spawned e.g. by showing a tool tip, in which case, the document will be closed when we reach the destructor.
Previously if we did something like:
CP_Resources = resources/*
The build file would correctly depend on the ‘resources’ directory, but a change, as in, adding, removing, or renaming a file, in a directory below ‘resources’ (e.g. adding ‘resources/English.lproj/NewWindow.xib’) would not correctly update the build file to include the new resource.
Incase of an empty string CFStringGetBytes() returns 0 which we treated as an error. This caused empty strings to be turned into the NULL_STR placeholder.
If the window hadn’t been loaded yet, we previously had to delay opening the document when changing tab (in code).
Since we now create the window in the initializer, there is no longer need for this.
Since 10% of reported crashes are in synchronizeWindowTitle and seems to be about not having a proper document pointer, I am adding these checks and some debug output — don’t understand how we would get into this situation though.
20% of reported crashes are in launch_tbz which indirectly call oak::c_array. My hunch is that the c_str buffer is overwritten because the std::string which returned it has been disposed, this makes strdup() do a bad allocation / memory read.
This would likely be a race condition (wrt. the c_str buffer) and coincidentally the oak::c_array is called in a thread (when it crashes).
This is so that a global setting for ‘source.ruby’ takes precedence over a local ‘source’ setting.
A minor downside is that a local properties file cannot use scoped settings outside a scope selector section.
It’s not feasible to maintain the old-style xib translations while we work on the UI. We’ll soon move fully to constraint-based layout which should allow translations to be purely string-based.
The main window has now moved fully to constraint based layout which makes it a lot easier to tweak the layout and fixes issue #145.
Presently the option to have HTML output on the right is not supported. It will likely be back with a few other options that have been requested.
The width of file browser and height of HTML output view is always read from defaults rather than restored from previous session. Effectively this results in the same behavior except when there are multiple windows with different sizing of these splits. Unsure if per-window sizes should be brought back.
With auto-layout the tab bar view can simply invalidate its intrinsic size when it should expand/collapse. This is also done if the global user setting for disabling tab bar collapsing is changed.
If e.g. we rename “image.tiff” → “image.png” then the build files are correctly updated to copy “image.png” to the build directory, but until this commit, the old tiff image would stay in the build directory until manually removing it / cleaning the build directory.
The gutter will invalidate its intrinsic size when its width changes which will cause the Cocoa layout engine to update the layout, so no more explicit code to deal with adjusting the gutter’s width.
Likewise, the height of the gutter (not the gutter scroll view) has been setup to match the height of the text view (again, not the containing scroll view). This avoids observing the text view frame and manually updating gutter height to match it.