Corey Johnson
10636b96bc
buildBufferSync can't be deprecated because TokenizedBuffer uses it
2014-04-22 16:48:01 -07:00
Corey Johnson
b5ac7c89a3
Update spec to match its description
2014-04-22 16:47:17 -07:00
Corey Johnson
01298bb470
Fix deprecation message
2014-04-22 16:22:23 -07:00
Nathan Sobo
752aa9a8e9
Handle editor:page-up/down commands
2014-04-22 17:10:23 -06:00
Nathan Sobo
e4639281f8
Handle 'editor:scroll-to-cursor' command
...
Add Editor::scrollToCursorPosition in the model layer
2014-04-22 17:10:23 -06:00
Nathan Sobo
f53d489abb
Add DisplayBuffer::scrollToScreen/BufferPosition
...
Also add delegators in Editor and ReactEditorView
2014-04-22 17:10:23 -06:00
Nathan Sobo
628c2f82bd
Add scrollTop/scrollLeft shims to ReactEditorView
2014-04-22 17:10:23 -06:00
Nathan Sobo
df8a6437a5
Set appended view to 'position: absolute' in ::appendToLinesView
2014-04-22 17:10:22 -06:00
Nathan Sobo
1f768a21f0
Update absolute position of lines and line numbers when text changes
...
When lines are inserted or removed, we need to manually shift the
on-screen lines since everything is absolutely positioned now.
2014-04-22 17:10:22 -06:00
Nathan Sobo
b13385b281
Subscribe to focus events with DOM api to prevent bubbling behavior
...
Using React's onFocus property, focus events seemed to bubble when
editors inside the editor were focused, as is the case with the
autocomplete menu.
2014-04-22 17:10:22 -06:00
Nathan Sobo
68d74e7de0
Put the hidden input component on its own layer
...
This avoids combining its repaint with the scrollbar's cursor position
when the cursor moves.
2014-04-22 17:10:22 -06:00
Nathan Sobo
c730e3c67e
Ensure selections span the entire screen, even when lines are short
...
Also, pass scrollHeight and scrollWidth as props to child components
instead of calling the method to compute them in multiple components.
2014-04-22 17:10:22 -06:00
Nathan Sobo
22496ceeb1
WIP: Minimize paint when scrolling and composite lines with the GPU
2014-04-22 17:10:22 -06:00
Nathan Sobo
a03f2f46ee
Don't assume tokens match text nodes when measuring character widths
2014-04-22 17:10:22 -06:00
Nathan Sobo
afec8f1ca0
Account for height of hidden input when positioning it
2014-04-22 17:10:22 -06:00
Nathan Sobo
43e6fb73f1
Focus react editor on attachment if it had focus previously
2014-04-22 17:10:22 -06:00
Nathan Sobo
a271e52a4e
Never assign a 0 height or width when measuring editor scroll view
2014-04-22 17:10:22 -06:00
Nathan Sobo
274ca33959
Don't measure height and width unless component is mounted
...
Since we measure in requestAnimationFrame, it's possible to request
measurement prior to be unmounted and have it occur afterward.
2014-04-22 17:10:22 -06:00
Nathan Sobo
10d6ec156f
Unsubscribe EditorComponent before unmounting
2014-04-22 17:10:22 -06:00
Nathan Sobo
4e27e765d0
Measure width and height when window size changes
...
Since overflowchanged events are paused for a bit after updates to
prevent thrashing, this ensures the editor is still updated promptly
when resizing.
2014-04-22 17:10:22 -06:00
Nathan Sobo
168cda4f75
Pause measurement on overflowchanged during updates
...
Content updates trigger overflowchanged, but we're mainly using it to
detect when the editor component has been resized. Pausing measurement
during content updates makes them faster.
2014-04-22 17:10:21 -06:00
Nathan Sobo
fdccc0bcc2
Measure DOM dimensions before rendering elements that depend on them
...
This commit breaks the initial render of the editor component into two
stages.
The first stage just renders the shell of the editor so the height,
width, line height, and default character width can be measured. Nothing
that depends on these values is rendered on the first render pass.
Once the editor component is mounted, all these values are measured and
we force another update, which fills in the lines, line numbers,
selections, etc.
We also refrain from assigning an explicit height and width on the
model if these values aren't explicitly styled in the DOM, and just
assume the editor will stretch to accommodate its contents.
2014-04-22 17:10:21 -06:00
Nathan Sobo
d566726b9f
Use negative z-indices so attached views are visible in react editor
2014-04-22 17:10:21 -06:00
Nathan Sobo
e9f2a536ed
Add more shims to ReactEditorView
2014-04-22 17:10:21 -06:00
Nathan Sobo
2532527a6a
Add editor-colors class to EditorComponent
2014-04-22 17:10:21 -06:00
Nathan Sobo
f10076c87d
Prevent activation events from bubbling
...
The react editor is wrapped in another div with the class of .editor for
backward compatibility. This prevents activation events registered on
the .editor selector from being triggered twice.
2014-04-22 17:10:21 -06:00
Nathan Sobo
083f65ed5d
Remove envify dependency
2014-04-22 17:10:21 -06:00
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