…so that we can write unit tests for code in the main process. Below a
list of conventions we'll be adopting:
1. Use mocha as the test framework.
2. Use chai as the assertion library.
3. Name specs `foo-bar.spec.js`, to prevent the renderer process from
running specs written fro the main process e.g. when calling
`atom --test spec`.
4. Write specs in ES6.
Although somewhat inconsistent with the conventions we use for renderer
process specs, this will hopefully be a first step towards migrating our
entire Jasmine 1.3 test suite to a more modern environment.
Rendering those line numbers in the gutter isn't useful, and it puts
unneeded pressure to the DOM. In the process of changing
`updateLineNumbersState`, we have also refactored it to stop relying on
row ranges being contiguous. This allows that code path to be:
1. Less error-prone, because we were trying to access rows that weren't
actually rendered, thus potentially throwing errors when measuring
non-contiguous screen rows that weren't visible.
2. Tighter, because we can just iterate over each screen row and ask for
its soft-wrap descriptor.
...because the only possible scenario when a logical position in a text
node cannot be found is when the requested pixel position is exactly at
the end of the node.
This fixes an annoying problem that prevented the state of marker layers
from being saved when the window was reloaded either via `Cmd+R` in
DevTools or via `Ctrl+Option+Cmd+L` in Atom.
The issue was that we were *always* scheduling `saveState` on an idle
callback: `window.onbeforeunload`, however, doesn't wait for that event
before closing the window, and thus that state was never saved in those
situations.
The solution is to use idle callbacks only during the critical code path
(i.e. on mousedown and keydown), but save it synchronously otherwise.
Saving something to IndexedDB is actually asynchronous too, but it seems
like Chrome fulfills `put` requests that get executed right during
`onbeforeunload`.