In https://github.com/atom/atom/pull/15503 we mistakenly assumed
`marker.isValid` accounted only for the validity of the marker. However,
that method returns `false` also for markers that are valid but have
been destroyed. As a result, the editor component was mistakenly not
removing block decorations associated with such markers.
With this commit we will rely on the local `wasValid` variable instead.
If its value is `true`, it means that the block decoration has been
accounted for in the `lineTopIndex` and must, as a result, be cleaned up
in case the marker or the decoration gets destroyed.
This prevents the dummy scrollbars from resetting their position to `0`
when the editor element is moved elsewhere in the DOM (e.g. when
splitting a pane item).
Previously, we used to verify the snapshot script by running it in a
new, empty context (similar to the one that `mksnapshot` creates when
generating the startup blob).
However, this context was being created using the Node version that
`script/build` was executed with. Such version may not match the Node
version shipped with Electron, and could thus cause the build script to
report "false negatives" when verifying the snapshot script. For
instance, running `script/build` with Node 4 would cause it to throw an
error when encountering keywords like `async`/`await`, even if they're
100% supported in Electron 1.6.9.
With this commit we are changing the snapshot verification code to use
the Node version bundled in Electron in order to avoid the
aforementioned mismatches.
Previously, when trying to use block decorations on non-empty markers,
Atom could sometimes throw an error if such markers ended or started at
a position that was not currently rendered.
In fact, even if we already restricted the decoration query to markers
that intersected the visible row range, markers that were only partially
visible would still be considered for rendering. If, depending on the
`reversed` property, we decided to render the tail or head of the marker
in question and this was outside the viewport, Atom would throw the
aforementioned exception.
This commit addresses the above issue by explicitly ignoring block
decorations that are located on rows that are not yet rendered.