Commit Graph

71 Commits

Author SHA1 Message Date
Corey Johnson
f4b7f86eb0 Revert "Remove editor-colors class from lines component"
This reverts commit 8cca198af1.
2014-06-11 10:02:16 -07:00
Corey Johnson
8cca198af1 Remove editor-colors class from lines component 2014-06-11 09:53:56 -07:00
Nathan Sobo
99611fad34 Give React editor lines and line numbers an opaque background
This ensures subpixel antialiasing works correctly. It was previously
present on both of these components but got dropped accidentally.
2014-06-11 08:51:19 -06:00
Nathan Sobo
7040906473 Ignore null bytes when measuring character widths in React editor
Fixes #2391
2014-06-11 07:18:52 -06:00
Nathan Sobo
9511c952af 💄 2014-06-03 18:19:11 +09:00
Nathan Sobo
3134bfda95 Update selections when the font size or font family change 2014-06-03 17:43:57 +09:00
Nathan Sobo
3aefa53b33 Batch together line and character width measurement after font changes
This ensures we only perform a single update with the most up-to-date
information about line height, default character width, and specific
character widths. If this update causes more lines to be drawn we may
measure again, but not necessarily.
2014-06-03 17:43:56 +09:00
Nathan Sobo
f467e3eed4 Move decision to measure lineHeight/charWidths to EditorComponent
This prevents the double-update of the lines component when changing
the font-size, line-height and font-family. We detect the update of
these values in the root component and trigger a measurement. If the
measurement determines that the pixel values have changed, *then* we
update the lines.
2014-06-03 17:43:56 +09:00
Nathan Sobo
1bce626324 Compute ranges of cursors & selections in EditorComponent and pass down
Previously, SelectionsComponenet::shouldComponentUpdate was storing the
ranges for selections as a side effect. We also were passing boolean
values (cursorMoved and selectionUpdated) to determine if these
components should update.

Now, we compute a simple hash of screen ranges for selections and
cursors in the root component and pass them down. This simplifies
shouldComponentUpdate for selections and allows us to implement one
for cursors.
2014-06-03 17:43:55 +09:00
Nathan Sobo
e222998f82 Only compare screenRow to mouseWheelScreen row when it is defined
Fixes #2482
2014-06-03 17:43:35 +09:00
Nathan Sobo
1187d50b81 Fix inequality in LinesComponent::shouldComponentUpdate
Change objects from the display-buffer are currently end-row inclusive.
I'd like to fix this, but not until we switch editors.
2014-06-02 19:17:30 +09:00
Nathan Sobo
f2a08cd178 Update the lines and gutter when the mouseWheelScreenRow changes 2014-05-31 08:56:56 +09:00
Nathan Sobo
df524e4803 Fix bug in LinesCompoent::shouldComponentUpdate 2014-05-31 08:56:32 +09:00
Nathan Sobo
0e31557abf Only measure character widths when editor is visible 2014-05-23 15:59:44 -06:00
Nathan Sobo
875cfefd36 Merge branch 'master' into ns-ks-react-dont-measure-when-hidden
Conflicts:
	spec/editor-component-spec.coffee
	src/editor-component.coffee
	src/editor-scroll-view-component.coffee
	src/lines-component.coffee
2014-05-22 10:48:21 -06:00
Nathan Sobo
b6fb996ceb Merge pull request #2327 from atom/ns-react-fork
Use Atom-specific fork of React allowing selection restoration opt out
2014-05-22 10:41:26 -06:00
Kevin Sawicki & Nathan Sobo
8ffcdad89a Re-measure the line height in pixels when the CSS line-height changes 2014-05-22 10:17:21 -06:00
Kevin Sawicki & Nathan Sobo
9e3ce09658 Rename lineHeight to lineHeightInPixels to distinguish from CSS value
CSS has a line-height property with values like '1.3', but we also have
a measured pixel value for line height. It's important to keep these
separate conceptually.
2014-05-22 10:17:12 -06:00
Kevin Sawicki & Nathan Sobo
45eeee9aea Ensure .lines div is always at least the height of the scroll view
This ensures that the wrap guide extends the entire height of the
editor.
2014-05-21 19:07:03 -06:00
Kevin Sawicki & Nathan Sobo
9cbc693c77 Avoid measuring lineHeight/defaultCharWidth on show unless needed
We only need to re-measure if the fontSize, fontFamily, or lineHeight
changed while the editor was hidden.
2014-05-21 17:35:57 -06:00
Kevin Sawicki & Nathan Sobo
ee9d4ab70e Don't measure lineHeight/defaultCharWidth when editor is hidden 2014-05-21 17:15:47 -06:00
Nathan Sobo
65b1e13b83 Use Atom-specific fork of React allowing selection restoration opt out
This fork of React allows data-react-skip-selection-restoration to be
defined on input elements, skipping costly selection restoration that
occurs when the input element is focused during reconciliation.
2014-05-20 23:05:13 -06:00
Nathan Sobo
9278920093 Merge branch 'master' into cj-add-invisibles-to-react-editor
Conflicts:
	src/editor-component.coffee
2014-05-20 17:03:14 -06:00
probablycorey
ece868c9de Concat strings instead of joining an Array 2014-05-20 15:16:07 -07:00
probablycorey
25e3ae0325 Re-render the lines when the showInvisible config option is triggered 2014-05-20 13:58:22 -07:00
probablycorey
2f038cbe66 Update lines component when invisibles changes 2014-05-20 12:34:18 -07:00
probablycorey
6880368a79 Add soft wrap support to invisibles 2014-05-20 11:49:31 -07:00
probablycorey
c999a6e0e4 Show carriage return invisibles 2014-05-20 10:38:01 -07:00
Nathan Sobo
6edb0b7a3d Delete dead method 2014-05-19 21:32:26 -06:00
Nathan Sobo
cd5f0c0047 Update the screenRow on the line element's dataset in ::updateLineNode 2014-05-19 21:32:26 -06:00
probablycorey
9b5593d020 Put EOL invisibles into their own scope 2014-05-19 17:27:59 -07:00
probablycorey
4d642b91ef Only pass invisibles through to the line component if needed 2014-05-19 17:10:36 -07:00
probablycorey
73ce81d597 Pass invisibles down to lines component 2014-05-19 16:56:53 -07:00
probablycorey
cbe07b49aa Add basic invisible specs 2014-05-19 16:20:51 -07:00
Nathan Sobo
795399e184 Preserve the target when scrolling w/ mousewheel on editor lines 2014-05-19 14:17:09 -06:00
Nathan Sobo
8e65d30a84 Compute rendered row range once in EditorComponent and pass it down 2014-05-16 20:58:40 -06:00
Nathan Sobo
9b7547cbe0 Get indent guide specs passing again 2014-05-16 15:31:16 -06:00
Nathan Sobo
fe82e3e30f Only clear screen row caches on lines component if lineHeight changes 2014-05-16 15:31:16 -06:00
Nathan Sobo
6017b73acf Add ability to look up line nodes by screen row 2014-05-16 15:31:15 -06:00
Nathan Sobo
0334177696 Make lineOverdrawMargin a property 2014-05-16 15:31:15 -06:00
Corey Johnson & Nathan Sobo
3f01e2f748 Implement shouldComponentUpdate for SelectionsComponent 2014-05-16 15:31:15 -06:00
Nathan Sobo
7dfe829fc8 Style lines with inline styles for performance 2014-05-16 15:31:15 -06:00
Nathan Sobo
c87bc57f9e Don't update top positions of lines/lineNodes unless they have changed 2014-05-16 15:31:15 -06:00
Nathan Sobo
d15fd34f7a Render selections on lines layer; don't put each line number on GPU 2014-05-16 15:31:14 -06:00
Nathan Sobo
a118cdd32b Put selections and lines on the GPU together in sibling divs 2014-05-16 15:31:14 -06:00
Nathan Sobo
3a2de9c698 Don't render every line on the GPU
Opaque lines are turning out to be a total pain, plus they ruin absolute
positioning on the lines div. The slight speed boost isn't seeming worth
it anymore.
2014-05-16 15:31:14 -06:00
Nathan Sobo
c60e5d90fd 💄 2014-05-16 15:31:14 -06:00
Nathan Sobo
695f8da3c3 💄 extract buildLineInnerHTML method 2014-05-16 15:31:14 -06:00
Nathan Sobo
ea5c5c9e84 Move line HTML generation into lines component 2014-05-16 15:31:14 -06:00
Nathan Sobo
4f9108980f WIP: Manually update line nodes when scrolling 2014-05-16 15:31:14 -06:00