Commit Graph

93 Commits

Author SHA1 Message Date
Ben Ogle
7179bc5af1 Merge pull request #2738 from atom/bo-fix-max-scroll-width
Fix max scroll width in react editor
2014-06-25 18:16:32 -07:00
Nathan Sobo
3bf0c73170 Assign line width explicitly to prevent full screen repaints
Fixes #2746
2014-06-25 19:13:50 -06:00
Ben Ogle & Nathan Sobo
f739dce210 Only recompute scroll width once for each batch of measured chars 2014-06-25 15:26:13 -07:00
Ben Ogle
9b577ecbf8 Make lines 100% of the width of their container
This is part of the solution to #2701. Lines need to be 100% wide in
case a class styles their background.
2014-06-23 22:46:27 -06:00
Ben Ogle & Nathan Sobo
76a911f17a Render highlights immediately to support underlayer shim 2014-06-23 16:23:45 -06:00
Nathan Sobo
7c356d2592 Revert "Render highlights on their own layer to avoid GPU artifacts" 2014-06-21 01:58:11 -06:00
Nathan Sobo
4218e0a037 Render highlights on their own layer to avoid GPU artifacts
Previously, when the last highlight div was removed from the lines
layer, chunks of the lines would sometimes disappear. Since we've
discovered that giving the lines an opaque background doesn't help with
subpixel anti-aliasing anyway, I've found that rendering highlights on
their own layer behind the lines and making the lines layer transparent
avoids the arficacts.
2014-06-20 15:18:19 -06:00
Nathan Sobo
64f3938f5c Batch all editor updates together automatically via process.nextTick 2014-06-20 15:06:10 -06:00
Ben Ogle
aef6991ca8 Set the decorations and previousDecorations vars before loops
Both loops use both vars, so both need to be available before the 
diffing!
2014-06-20 11:29:18 -07:00
Ben Ogle
e8db3e97ce Remove cached decorations for removed lines 2014-06-20 11:28:01 -07:00
Ben Ogle
1228435f9b 💄 2014-06-20 11:00:40 -07:00
Ben Ogle
593b5b4e36 Use _.deepContains 2014-06-20 10:50:12 -07:00
Ben Ogle
72b1821828 Render line decorations. 2014-06-19 17:20:05 -07:00
Nathan Sobo
388763e7cd Wait to measure characters if editor is hidden
Also, when characters *are* measured, request a display update
2014-06-19 04:19:51 -06:00
Ben Ogle
7a9710b8c3 Add fold markers to folded lines
Fixes #2634
2014-06-18 13:47:38 -07:00
Nathan Sobo
f1f83a7d36 Add a comment explaining the .editor-colors class on .lines 2014-06-18 12:36:40 -06:00
Nathan Sobo
5d15af943e Rename filterDecorationsByMarkerId to getHighlightDecorations
And rename local variable to highlightDecorations to clarify intent
2014-06-17 14:31:56 -06:00
Ben Ogle
34ec15862f Filter decorations in the components.
This reduces the number of intermediate objects we need to create. The 
downside is a bit more code complexity in the components.
2014-06-16 16:54:21 -07:00
Ben Ogle
4f2f158d0d Make selection updating work properly 2014-06-16 15:36:09 -07:00
Ben Ogle
408e62a993 Pass highlightDecorations into the HighlightsComponent 2014-06-16 15:36:08 -07:00
Ben Ogle
1ebdd801f5 Use decorations to render selections 2014-06-16 15:36:08 -07:00
Ben Ogle
084632a985 Rename Selection(s)Component to Highlight(s)Component 2014-06-16 15:36:08 -07:00
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