We build a native `OnigScanner` object at the `Rule` level which tries to match every regex for the entire rule, rather than using an individual regex for each pattern from the JS side.
This metadata will be used to record the indentation level of the first line when copying multiple lines of text to the pasteboard. The pasteboard takes the md5 of the pasted content when writing, then when reading it associates the last written metadata only when the signature matches the previously written value.
When an open bracket is inserted, an anchorRange is created. When a closing bracket is inserted, and its position matches the end of one of the anchorRanges, the closing bracket is not inserted and the cursor moves right.
When we actually want to attach the root view in window-bootstrap.coffee, we call `window.attachRootView(path)` instead of calling `window.startup(path)`. Having `startup` called automatically means we can be sure any code we add there runs in every environment (including benchmark and specs). This is where we do things like setup the global keymap, parse text mate bundles and themes, and establish the window close handler. Any globals other than the root view that we want to be available in all environments should be established here. Right now that's just the keymap, but soon I want to add a global pasteboard.
Previously this data was only sent to the done
handlers and so commands such as SelectAllMatchesInProject
were not displaying all the results when the result size
was large.
If we're pasting multiple lines starting inside an already existing line, we never want to auto indent. We should just take its existing indentation level. Also, we strip the leading whitespace off the first line we're inserting, assuming it's already being represented by the indentation of the line we're onto which we're appending it.
Also, when some lines are *less* indented than the first line, it might not be possible to outdent them as far as they originally were relative to the first line, so we do as much as possible.