Fixes#3108
Unmounting the component the first time can cause a focusout event,
which leads to a redundant removal and an attempt to unmount again. This
protects against that.
On Chromium 35, the screen seems to be full-screen painting on a Cinema
Display every few frames, causing frame rates to drop from 60 to 30 when
autoscrolling with the cursor. Increasing the overdraw avoids this.
Previously, each editor observed font-related config values on its own
and applied inline styles to honor them. This made it difficult to style
the editor like a normal element with CSS.
Moving this to a global stylesheet that targets editors via the .editor
selector means that the font size setting can be overridden in specific
contexts, such as when using mini editors.
Previously, font styling was always explicitly assigned via the config.
This commit is the first step in basing the font styling of the editor
on the styles assigned via CSS. This will allow the editor's
font-family, font-size, and line-height to be assigned via CSS just like
they are for any other element, which will make it easier to style mini
editors.
We still need to switch the font settings to adjust a global stylesheet
rather than updating inline styles on each editor individually.
In 444c18be34, I stopped polling the DOM
when an update was pending to prevent delay of the next animation frame.
Unfortunately, we rely on synchronously polling the DOM when an editor
view is attached to perform the initial measurement of the default char
width, which is required to position the wrap guide.
In componentWillMount, observing the config was requesting an update,
causing us to skip this synchronous update at attachment time and
position the wrap guide wrong.
This prevents update requests that occur before mount from pausing the
polling that we perform on attachment, restoring correct function to the
wrap guide.
Fixes#3099.
React development mode has a lot of useful warnings and exceptions. These don't
show up in production mode. This change puts React into dev mode when Atom is
run via `atom --dev`.
In Chrome 31, setImmediate was yielding better behavior. But now Chrome
35 seems to behave more smoothly when we use requestAnimationFrame, and
the delay for keystrokes is non-existent.
Now that we mount the react component in the constructor of the wrapper
view, it's never actually visible at the time of mount. By invoking
pollDOM manually after attaching and before emitting the attach event,
the character width is available for the wrap guide to calculate its
initial position.
This prevents a flicker that occurred on theme changes when we just
detected this via polling. I'm going to leave the polling as a catch-all
in case the editor is styled inline in some way.
We sample both the background color of the editor and the gutter. If the
gutter has an actual background color, we use it. Otherwise we fall back
to the same background as the editor.
This ensures lines have an opaque background that matches whatever the
editor is styled as, but avoids the need to apply the .editor-colors
class to the .lines div. That approach fell down when people were
setting the background color via means other than .editor-colors, such
as styling mini editors via the .editor.mini selector in the settings
view.