Commit Graph

109 Commits

Author SHA1 Message Date
Kevin Sawicki
590a4b0fd5 Add explicit return after for loop 2015-03-19 11:48:40 -07:00
Antonio Scandurra
a12bf66e41 Merge branch 'master' into batch-updates 2015-02-28 10:21:48 +01:00
Antonio Scandurra
0dca5a5fcd Encapsulate state update inside TextEditorPresenter#getState 2015-02-28 09:25:53 +01:00
Ivan Zuzak
09ed657c69 Dont show foldable icon of soft wrapped lines 2015-02-27 15:30:49 +01:00
Nathan Sobo
168df987d7 Make GutterComponent a plain JS object instead of a React component 2015-02-19 17:14:53 -07:00
Nathan Sobo
2d771ab8e4 Perform GutterComponent DOM updates manually 2015-02-19 17:14:53 -07:00
Nathan Sobo
679cadabde Store maxLineNumberDigits in oldState 2015-02-19 17:14:53 -07:00
Nathan Sobo
c06e100fae Make LinesComponent a normal object instead of a React component
Also, remove ability to disable hardware acceleration since there’s
no longer a need for it and it complicated this conversion.
2015-02-19 17:14:53 -07:00
Nathan Sobo
6a36bdda25 Replace ::hasRequiredMeasurements() with specific criteria in presenter
Now each update method requires a list of specific variables to be
defined before running.
2015-02-12 19:48:06 -07:00
Nathan Sobo
98e126b40d Remove redundant require 2015-02-11 07:54:54 -07:00
Nathan Sobo
bbc1a264b5 Make each section of presenter state self-contained
This means we have some duplicated values in different parts of the
tree, but it’s cleaner in the view since each component only consumes
a single object. Seems like the presenter should convey the correct
data to the correct locations and minimize the logic in the view. A
few duplicated integers is a reasonable trade-off.
2015-02-03 15:05:31 -07:00
Nathan Sobo
76241fb779 Handle line and line number preservation in presenter
The target of mousewheel events needs to be preserved when scrolling.
It used to be dealt with in the view, but now we can do it in the
presenter for a simpler view implementation.
2015-02-03 15:05:29 -07:00
Nathan Sobo
a88486e950 Use maxLineNumberDigits from presenter state in GutterComponent 2015-02-03 15:05:28 -07:00
Nathan Sobo
fd50a0db6c Construct TextEditorPresenter before component mounts
This allows us to use the presenter for all stages of the component
lifecycle rather than needing to wait until it is created.

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2015-02-03 15:05:28 -07:00
Max Brunsfeld
60fca8d8b2 Use presenter state for gutter background color
Signed-off-by: Nathan Sobo <nathan@github.com>
2015-02-03 15:05:27 -07:00
Nathan Sobo
b1fe567ce8 Build line numbers based on presenter state 2015-02-03 15:05:24 -07:00
Nathan Sobo
182531a010 Use presenter for gutter scrollHeight and scrollTop
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2015-02-03 15:05:23 -07:00
Nathan Sobo
8c574bfd30 Rename 'gutter' decorations to 'line-number' decorations 2015-01-14 19:49:46 -07:00
Nathan Sobo
b86f6870c5 Use native event handlers instead of React
React event handlers don’t work because of the shadow DOM
2014-11-04 16:37:22 -07:00
Ivan Zuzak
29ad748aa4 Dont propagate fold icon clicks to editor component 2014-09-03 18:52:50 +02:00
Nathan Sobo
7738eeeacc Give the line-numbers div an opaque background for better GPU perf
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.
2014-07-24 17:23:04 -07:00
Nathan Sobo
d3a46b6bc9 Don't try to update lines/line numbers until after initial measurement
Fixes #3047
2014-07-24 10:27:38 -07:00
Ben Ogle
2a9c78ef92 Move horiz scrollbar into the scrollView
Also remove all the gutter width calculation. It was flawed anyway,
2014-07-23 16:20:48 -07:00
Ben Ogle
d3a6e79428 The horizontal scrollbar takes gutter width into account 2014-07-22 18:26:58 -07:00
Nathan Sobo
ba21f0b0d8 Eliminate duplicate 'gutter' class
This was previously needed when we applied 'editor-colors' to the
line numbers to give them an opaque background in hopes of supporting
sub pixel AA, but that dream is dead for now anyway. This makes the
gutter harder to style, so I'm nixing it.
2014-07-21 14:56:09 -07:00
Nathan Sobo
a68b9a793f Don't update the GutterComponent if there's no renderedRowRange 2014-07-21 14:28:48 -07:00
Nathan Sobo
38b286f989 Remove 'editor-colors' class from lines and gutter for mini editors
Having the editor-colors class on these elements was causing the theme
to be applied to lines in mini editors in the settings view, which
caused a black inset box to appear with dark syntax themes.

This was added to give the lines an opaque background which was supposed
to enable sub pixel anti-aliasing despite being on the GPU, but it
didn't seem to be working. Perhaps we can revisit this issue after the
Chrome 35 upgrade to see if sub pixel antialiasing works with opaque
backgrounds afterward.
2014-07-21 13:50:58 -07:00
Ben Ogle
9976166902 Render the line numbers after gutter mount
Fixes #2916
2014-07-10 17:25:58 -07:00
Ben Ogle
475f92351f == -> is 2014-07-10 10:40:49 -07:00
Ben Ogle
7be5553ba1 Index line decorations by ids
And don’t use _.deepContains
2014-07-09 12:51:52 -07:00
Ben Ogle
80eb31679f Add a Decoration object. Rework to use this object 2014-07-03 17:32:37 -07:00
Nathan Sobo
0edfbaebeb Rename editor option to useHardwareAcceleration 2014-07-01 12:17:43 -06:00
Nathan Sobo
512d4da587 Add editor.gpuDisabled option to prevent React editor from using layers
When gpuDisabled is true, we use `translate` instead of `translate3d`
to position various elements, preventing the creation of GPU layers.
2014-07-01 11:56:05 -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
d839ea9aa5 Don't render an opaque background behind line numbers
It doesn't help subpixel anti-aliasing like I thought, so screw it.
2014-06-20 16:07:19 -06:00
Ben Ogle
dee0771dd7 Use ? in the conditional. 2014-06-20 12:50:42 -07:00
Ben Ogle
b1dd4f2e8e Index the previous decoration cache by lineNumberId rather than screenRow
Why? Screen rows change. If some operation (folding?) changes the 
screen rows and the decorations at the same time, the previous 
decorations will no longer be valid and can no longer be diffed against 
the decorations to-be-rendered.
2014-06-20 11:27:39 -07:00
Ben Ogle
593b5b4e36 Use _.deepContains 2014-06-20 10:50:12 -07:00
Ben Ogle & Nathan Sobo
9083103bb3 Add click and shift-click in gutter 2014-06-19 12:04:36 -07:00
Nathan Sobo
609855af3c Decide to measure gutter's width in gutter
The gutter is in a better position to determine if the max line number
length has changed because it's a property that gets passed in so we
can compare current with previous.

Fixes #2659
2014-06-18 21:07:13 -06:00
Nathan Sobo
8d87eb2ed6 Style the .line-numbers div to be compatible w/ both themes and the GPU
The .line-numbers div has to have an opaque background because it's
sent as a texture to the GPU, and otherwise it will have isuses with
subpixel antialiasing.

However, themes style the background of the .gutter div, which was
getting obscured by the opaque background of the line numbers. This
commit adds the .gutter class to the .line-numbers div as well and
ensures it always fills the entire height of the editor.
2014-06-18 12:36:40 -06:00
probablycorey
bacd612c71 Apply editor-colors style to gutter
Closes #2596
2014-06-18 09:42:33 -07:00
Nathan Sobo
2fffbba503 Eliminate Decoration class and use plain objects instead 2014-06-17 17:35:56 -06:00
Nathan Sobo
4832d36ac1 Rename filterDecorationsByScreenRow to getLineDecorations
Also rename local variable to lineDecorations for clarity
2014-06-17 14:35:56 -06:00
Ben Ogle
ef09fbbfb2 Remove softWrap decoration option 2014-06-17 11:24:27 -07: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
d4057d21c7 Pass the decoration hash into the gutterComponent 2014-06-16 15:36:08 -07:00
Ben Ogle
b028673b5d Only render on updates 2014-06-16 15:36:08 -07:00
Ben Ogle
2d4360dcf0 Decorations can now only be attached to markers.
The basics work. It will render them on the gutter.
2014-06-16 15:36:08 -07:00