Nathan Sobo
f59a8f1e68
Return function arg's result from Editor::batchUpdates
2014-04-22 17:09:45 -06:00
Nathan Sobo
bef554709f
Emit 'cursor:moved' event to update cursor position in status bar
...
Emitting the event *before* update, rather than after. This is because
we read from the DOM after update to measure new characters, which
forces layout, so emitting the event after measuring forces another
layout when the position is updated.
2014-04-22 17:09:45 -06:00
Nathan Sobo
e5379515b9
Transfer focus to ReactComponent when wrapper view is focused
2014-04-22 17:09:45 -06:00
Nathan Sobo
a0ff6f5325
Handle 'autoscroll' option in model when setting selected buffer range
2014-04-22 17:09:45 -06:00
Nathan Sobo
dd4b6a6d28
Don't render empty selections
2014-04-22 17:09:45 -06:00
Nathan Sobo
51ee591282
Don't render cursors for non-empty selections
2014-04-22 17:09:45 -06:00
Nathan Sobo
19a5269a5f
Remove metaprogrammed method delegators
2014-04-22 17:09:45 -06:00
Nathan Sobo
9b6fa967be
Handle the editor:consolidate-selections command in the React editor
2014-04-22 17:09:45 -06:00
Nathan Sobo
201e00aa83
Don't measure new lines when scrolling with the mousewheel
...
It impacts scrolling performance. We can measure when scrolling comes
to a halt.
2014-04-22 17:09:44 -06:00
Nathan Sobo
f02d956362
Preserve the only the target screen row when scrolling via mousewheel
...
When the target of a mousewheel event is removed, it breaks velocity
scrolling.
Previously, we were preserving the entire screen range when scrolling
with the mouse wheel, which caused a lot of DOM nodes to accumulate. Now
we only preserve the individual line and line number associated with the
target of the mousewheel event, moving them just off screen below all
the on-screen lines and line numbers. This keeps the number of DOM nodes
limited while retaining velocity effects.
2014-04-22 17:09:44 -06:00
Nathan Sobo
798739f837
Use beforeRemove instead of non-existent beforeDetach
2014-04-22 17:09:44 -06:00
Nathan Sobo
216d561c79
Delay creating range and node iterator until we actually need to measure
2014-04-22 17:09:44 -06:00
Nathan Sobo
6607f99c6c
Use padding-top/bottom rather than spacer divs in lines and gutter
...
It creates a simpler DOM structure.
2014-04-22 17:09:44 -06:00
Nathan Sobo
3a42346e5e
Pause cursor blink as part of the overall editor update
...
This ensures we don't perform two updates of the cursors component when
cursors move as part of a larger change, such as typing text.
2014-04-22 17:09:44 -06:00
Nathan Sobo
ae9f79bfc4
Only add indent guide to trailing whitespace on whitespace-only lines
2014-04-22 17:09:44 -06:00
Nathan Sobo
5a9a3c62e1
Implement shouldComponentUpdate for LinesComponent
...
We accumulate pending changes and pass them to the lines and the gutter
to help them determine whether to update. The lines only update if the
visible row range changed or if there was a change in the visible row
range.
2014-04-22 17:09:44 -06:00
Nathan Sobo
d678f367db
Clear cursor blink interval when editor component unmounts
2014-04-22 17:09:44 -06:00
Nathan Sobo
febfb120c8
Fix typo
2014-04-22 17:09:44 -06:00
Nathan Sobo
addbe80e8a
Update the gutter if the scrollTop has changed
2014-04-22 17:09:44 -06:00
Nathan Sobo
b96abfffb7
Add more displayNames
2014-04-22 17:09:44 -06:00
Nathan Sobo
a6f2e926fe
Upgrade to underscore-plus@1.2.1 for optimized isEqualForProperties
2014-04-22 17:09:44 -06:00
Nathan Sobo
550a4ce906
Use isEqualForProperties in LinesComponent to decide when to re-measure
2014-04-22 17:09:43 -06:00
Nathan Sobo
1a56b487a1
Stop propagation of input events to prevent react from doing extra work
...
React seems to be handling these events when they bubble to the root of
the document. We want to avoid wasting time on this.
2014-04-22 17:09:43 -06:00
Nathan Sobo
4fa9c64c2b
Drop batchedUpdates on input since we're batching in the model anyway
2014-04-22 17:09:43 -06:00
Nathan Sobo
56e5fb7a63
Set process.env.NODE_ENV to 'production' to speed up React
2014-04-22 17:09:43 -06:00
Nathan Sobo
efa72bcb1c
Implement shouldComponentUpdate for GutterComponent
...
Only update the gutter when the visible row range has changed or if
a screen lines change has occurred within the visible row range.
2014-04-22 17:09:43 -06:00
Nathan Sobo
033db8997b
Batch updates when moving cursors
...
This ensures that updates associated with autoscroll and cursor movement
get combined.
2014-04-22 17:09:43 -06:00
Nathan Sobo
64a487eebb
Implement shouldComponentUpdate for ScrollbarComponent
...
It checks that the incoming scrollTop/Left and scrollHeight/Width differ
from their current values. The scrollTop/Left value are updated in
the component properties to always reflect the state of the DOM when
scrolling or when assigning a new value.
2014-04-22 17:09:43 -06:00
Nathan Sobo
ddc677fb30
Batch multiple view updates with Editor::batchUpdates
2014-04-22 17:09:43 -06:00
Nathan Sobo
fe6a007774
Call requestUpdate instead of forceUpdate so we can track all updates
2014-04-22 17:09:43 -06:00
Nathan Sobo
48d90e3dfc
Funnel cursor and selection updates through EditorComponent
2014-04-22 17:09:43 -06:00
Nathan Sobo
f457b41a81
Assign a key to cursor and selection components
2014-04-22 17:09:43 -06:00
Nathan Sobo
93388c2048
Make Cursor and Selection models for automatic id assignment
2014-04-22 17:09:43 -06:00
Nathan Sobo
66f3f2d883
Add displayName to components
2014-04-22 17:09:42 -06:00
Nathan Sobo
3657dc0bf4
💄
2014-04-22 17:09:42 -06:00
Nathan Sobo
274288161d
Make line number components immutable
2014-04-22 17:09:42 -06:00
Nathan Sobo
0d03e388f1
💄 spec description
2014-04-22 17:09:42 -06:00
Nathan Sobo
507106d35b
💄 method order
2014-04-22 17:09:42 -06:00
Nathan Sobo
eeba559ec7
Add a SelectionsComponent containing all selections
2014-04-22 17:09:42 -06:00
Nathan Sobo
14bfa90004
Extract a CursorsComponent containing all cursors
2014-04-22 17:09:42 -06:00
Nathan Sobo
0ec6cbe141
💄 method order
2014-04-22 17:09:42 -06:00
Nathan Sobo
e952ab2e02
Extract a LinesComponent
2014-04-22 17:09:42 -06:00
Nathan Sobo
5c2eb053d8
Extract an EditorScrollView component
2014-04-22 17:09:42 -06:00
Nathan Sobo
aee552476a
Call onScroll with the current scrollTop/Left in ScrollbarComponent
2014-04-22 17:09:42 -06:00
Nathan Sobo
355abef2cf
Manage update of scrollbar scroll positions in ScrollbarComponent
2014-04-22 17:09:42 -06:00
Nathan Sobo
cec62c56a6
Extract a ScrollbarComponent
2014-04-22 17:09:41 -06:00
Nathan Sobo
35ea4e6de4
Extract gutter to its own component
2014-04-22 17:09:41 -06:00
Nathan Sobo
8c266957f1
Isolate CSS changes to a single selector
2014-04-22 17:09:41 -06:00
Nathan Sobo
f1f93f2f70
Spy on setInterval explicitly when needed in EditorComponent spec
2014-04-22 17:09:41 -06:00
Nathan Sobo
de773e4f75
Revert "Remove setInterval spy. It's now spied in the spec helper w/ setTimeout"
...
This reverts commit 930f1d7f018bb9949b0ee0e4ca7330a8a4ce0ec7.
I actually don't want to globally spy on setInterval because it interferes with
expected behaviors and eventually I'd like both of these to be opt-in.
2014-04-22 17:09:41 -06:00