Commit Graph

64 Commits

Author SHA1 Message Date
Nathan Sobo
527ada47f9 Account for gutter width in scrollWidth of horizontal scrollbar
Because the scrollbar now spans the entire editor but the scrollable
area does not include the gutter, we need to add the current width of
the gutter to the scroll width of the horizontal scrollbar to allow
it to scroll to the end of the longest lines.
2014-05-09 11:33:03 -06:00
Nathan Sobo
afb70d0a95 Remove stray return in spec 2014-05-09 11:33:03 -06:00
Nathan Sobo
b5f910ad06 Update line number padding when max digits changes 2014-05-09 11:33:03 -06:00
Nathan Sobo
e6df30e94c Respect horizontal scrollbar when rendering the vertical, and vice versa
We set overflow to hidden in the opposite scroll direction only if we
can't actually scroll in that direction, causing the white square where
neither scrollbar overlaps to appear at the lower right corner.
2014-05-09 11:33:03 -06:00
Nathan Sobo
d9ba9262bf Update scrollTop to valid position when scrollbar disappears 2014-05-09 11:33:03 -06:00
Nathan Sobo
c4be32a5dd Revert "Revert "Don't obscure the last line of the editor with the horizontal scrollbar""
This reverts commit 1d634e471e.
2014-05-09 11:33:03 -06:00
Kevin Sawicki
960285a270 Unfocus EditorComponent spec 2014-04-29 16:11:20 -07:00
Corey Johnson
c7e308bca0 Remove use of OpenSync from specs 2014-04-24 14:14:10 -07:00
Nathan Sobo
1d634e471e Revert "Don't obscure the last line of the editor with the horizontal scrollbar"
This reverts commit babbdbf9e5.
2014-04-23 14:03:33 -06:00
Nathan Sobo
babbdbf9e5 Don't obscure the last line of the editor with the horizontal scrollbar
This assumes the scrollbar is 15px high, which is incorrect when using
overlay scrollbars or when the scrollbar is styled to have a different
height. We'll need to measure it in a subsequent commit.
2014-04-23 13:59:35 -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
22496ceeb1 WIP: Minimize paint when scrolling and composite lines with the GPU 2014-04-22 17:10:22 -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
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
9b6fa967be Handle the editor:consolidate-selections command in the React editor 2014-04-22 17:09:45 -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
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
ae9f79bfc4 Only add indent guide to trailing whitespace on whitespace-only lines 2014-04-22 17:09:44 -06:00
Nathan Sobo
0d03e388f1 💄 spec description 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
f1f93f2f70 Spy on setInterval explicitly when needed in EditorComponent spec 2014-04-22 17:09:41 -06:00
Nathan Sobo
495b1571ca Add 'editor' class to ReactEditorView wrapper for backward compatibility 2014-04-22 17:09:40 -06:00
Nathan Sobo
59709a92ba Include SpacePen wrapper view in spec
During the transition to React, it will be easier if the EditorComponent
assumes it's rendered inside the ReactEditorView. This will make it
easier to test compatibility with existing editor APIs.
2014-04-22 17:09:40 -06:00
Nathan Sobo
022f5ca219 Replace previous character when inserting accented characters 2014-04-22 17:09:40 -06:00
Nathan Sobo
96ebb9bf03 Correctly position cursor on mousedown when editor is scrolled left 2014-04-22 17:09:40 -06:00
Nathan Sobo
95b24fb933 Position the hidden input on the most recent cursor when in view
We won't position the hidden input out of the scroll view's bounds to
prevent Chromium's autoscrolling behavior.
2014-04-22 17:09:40 -06:00
Nathan Sobo
9bdc78df2e Correctly render lines containing only whitespace 2014-04-22 17:09:40 -06:00
David Graham & Nathan Sobo
241731f9c8 Render indent guides on empty lines 2014-04-22 17:09:39 -06:00
David Graham & Nathan Sobo
1c48f60e42 Render indent guide for react editors on non-empty lines 2014-04-22 17:09:39 -06:00
David Graham & Nathan Sobo
985662b8f0 Only scroll in one direction a time with the mousewheel 2014-04-22 17:09:39 -06:00
David Graham & Nathan Sobo
cfdea7e73f Update the scrollLeft of the model when the horizontal scrollbar changes 2014-04-22 17:09:39 -06:00
David Graham & Nathan Sobo
48135a1e8d Update the horizontal scrollbar when scrollLeft changes in the model 2014-04-22 17:09:38 -06:00
Nathan Sobo
84bb624b5b Set x-transform of .scroll-view-content based on the model's scrollLeft 2014-04-22 17:09:38 -06:00
Nathan Sobo
486a7937b5 Render • instead of line number for soft-wrapped lines 2014-04-22 17:09:38 -06:00
Nathan Sobo
1162af61ed Render a basic gutter 2014-04-22 17:09:38 -06:00
Nathan Sobo
0fd8c5441c 💄 spec organization 2014-04-22 17:09:38 -06:00
Nathan Sobo
f5551929d8 Account for half-visible lines in DisplayBuffer::getVisibleRowRange
We need to add 1 to the editor's height in lines, because it's possible
to have *partially visible* lines at the top and the bottom.
2014-04-22 17:09:38 -06:00
Nathan Sobo
4a501a7c31 Fix incorrect triple-click spec 2014-04-22 17:09:38 -06:00
Nathan Sobo
d0c61eb2be Pause cursor blinking when the cursor moves 2014-04-22 17:09:38 -06:00
Nathan Sobo
2b0ef68255 Blink cursors always. Still need to pause blinking when moving. 2014-04-22 17:09:37 -06:00
Nathan Sobo
f60f9b9f4f Add 'is-focused' class to editor when hidden input is focused 2014-04-22 17:09:37 -06:00
Nathan Sobo
4f10500102 Select lines on triple-click 2014-04-22 17:09:37 -06:00
Nathan Sobo
096afcf6f3 Finalize selections on mouseup 2014-04-22 17:09:37 -06:00
Nathan Sobo
2204571ef5 Select words on double-click 2014-04-22 17:09:37 -06:00
Nathan Sobo
c4be3069f7 Select on mouse drag 2014-04-22 17:09:37 -06:00
Nathan Sobo
accee294dc Test against real mousedown events dispatched on the .lines DOM node 2014-04-22 17:09:37 -06:00
Nathan Sobo
1239ab540f 💄 spec descriptions 2014-04-22 17:09:37 -06:00
Nathan Sobo
5a0d7e716b When cmd-clicking, add a new cursor at the nearest screen position 2014-04-22 17:09:37 -06:00