Commit Graph

243 Commits

Author SHA1 Message Date
probablycorey
f962888b35 Remove unnecessary spec 2014-05-20 11:49:40 -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
probablycorey
2bbf5c7800 Remove unnecessary spec 2014-05-20 10:37:24 -07:00
probablycorey
273203e4c9 Fix typo 2014-05-20 10:37:02 -07:00
probablycorey
9b5593d020 Put EOL invisibles into their own scope 2014-05-19 17:27:59 -07:00
probablycorey
8b4cff474f Spec 💄 2014-05-19 17:10:04 -07:00
probablycorey
73ce81d597 Pass invisibles down to lines component 2014-05-19 16:56:53 -07:00
probablycorey
cbe07b49aa Add basic invisible specs 2014-05-19 16:20:51 -07:00
Nathan Sobo
bfc382c398 Add specs for line/line-number preservation 2014-05-19 14:33:17 -06:00
Nathan Sobo
c058483422 Update the gutter width when the number of digits changes 2014-05-16 15:56:18 -06:00
Nathan Sobo
9b7547cbe0 Get indent guide specs passing again 2014-05-16 15:31:16 -06:00
Nathan Sobo
e74dfe3438 Fix gutter specs and update lines when digit counts change 2014-05-16 15:31:16 -06:00
Nathan Sobo
b000e8e4a2 Get selection specs passing again 2014-05-16 15:31:16 -06:00
Nathan Sobo
64c82f1c87 Update cursor positioning text for simplified token markup 2014-05-16 15:31:15 -06:00
Nathan Sobo
0ad2730353 Update specs for new line node rendering approach
Lines are no longer translated on the GPU, and they aren't inserted into
the DOM in an order that reflects their order in the buffer.
2014-05-16 15:31:15 -06:00
Nathan Sobo
070d239f41 Blink cursors with a CSS animation
Now that they're on their own layer, I don't think it affects the
repaint timing when typing on lines (if it ever did).
2014-05-16 15:31:13 -06:00
Nathan Sobo
9001d34ddf Change selection specs to match new rendering scheme 2014-05-16 15:31:13 -06:00
Nathan Sobo
e44027b186 Fix the height/width of the editor in spec
Now that everything is absolutely position, the editor no longer assumes
a "natural" height and width. This can be addressed later if we want to
allow editors to expand based on their content.
2014-05-16 15:31:13 -06:00
Nathan Sobo
d53f97ecfe Fix horizontal scrolling spec 2014-05-16 15:31:13 -06:00
Nathan Sobo
f3efd7d60b Position cursors relative to scrollLeft and fix specs 2014-05-16 15:31:12 -06:00
Nathan Sobo
8d25da9474 Update line number rendering specs for new layer scheme 2014-05-16 15:31:12 -06:00
Nathan Sobo
1aee276b45 Update line rendering specs for new layer scheme 2014-05-16 15:31:12 -06:00
Nathan Sobo
1c1ace90db Hide and show scrollbars before measuring them after stylesheet changes
We measure the scrollbar-corner node when there's a stylesheet change,
but Chromium won't apply the new style if it was already visible before
the change. This commit hides and shows it before measuring so we get
accurate values.
2014-05-09 11:33:04 -06:00
Nathan Sobo
bdd605e85b Explicitly assign dummy scrollbars to the correct width/height
Previously, dummy scrollbars were always 15px wide/tall. This caused
them to obscure the ability to click for the entire 15px region, even if
the actual scrollbar was styled to be much thinner. Now we explicitly
measure the size of scrollbars on mount and when the stylesheets change
and set the height/width explicitly.
2014-05-09 11:33:04 -06:00
Nathan Sobo
e1b4b921ba Hide scrollbar when not scrollable in a given direction 2014-05-09 11:33:04 -06:00
Nathan Sobo
ab1ede5fe6 Add a dummy scrollbar corner
Horizontal / vertical scrollbars render a 'corner' on the lower right
when they would otherwise overlap. I previously relied on drawing both
dummy scrollbars at their full width/height so the corner got rendered,
but that interfered with the display of the horizontal scrollbar in
certain circumstances because it was too wide to scroll. This commit
provides that behavior with an absolutely positioned div with the same
dimensions as the intersection of scrollbars when both are visible.
2014-05-09 11:33:04 -06:00
Nathan Sobo
5e6d91d66c Don't allow spec window size to interfere with the size of the editor 2014-05-09 11:33:04 -06:00
Nathan Sobo
dbd271f70a Don't obscure last character of long lines with vertical scrollbar
This entailed quite a few changes to dial in scrollbars. The scrollbars
are now adjusted in size to account for the width of the opposite
scrollbar. If the width or height are not explicitly constrained and we
are scrollable in the opposite direction that is constrained, we account
for the width of the opposite scrollbar in assigning a natural height
or width based on the content.
2014-05-09 11:33:04 -06:00
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
Nathan Sobo
7738e74df0 When shift-clicking, select to the clicked position 2014-04-22 17:09:36 -06:00
Nathan Sobo
3a433f734c Move the cursor on single click 2014-04-22 17:09:36 -06:00
Nathan Sobo
e24196c0ef Require React directly rather than via reactionary
Reactionary is just a tiny helper library that can rely on the react
installed by the requiring application instead.
2014-04-22 17:09:36 -06:00
Nathan Sobo
57e2cf80f4 💄 Reorganize spec 2014-04-22 17:09:05 -06:00
Nathan Sobo
669586c11b 💄 2014-04-22 17:09:05 -06:00
Nathan Sobo
3d3b72a954 Render selections 2014-04-22 17:09:04 -06:00
Nathan Sobo
ab02d5f25f Update the vertical scroll bar when scrollTop changes in the model 2014-04-22 17:09:04 -06:00
Nathan Sobo
53cc5c9856 Base cursor x position on char widths stored in DisplayBuffer
Whenever new lines are added to the screen, we measure and store any
unseen scope/character combinations in the DisplayBuffer.
2014-04-22 17:09:03 -06:00
Nathan Sobo
6327094696 Transfer focus from editor component to its hidden input 2014-04-22 17:09:03 -06:00
Nathan Sobo
c4fdb54650 Update editor component when a visible selection is removed 2014-04-22 17:09:03 -06:00
Nathan Sobo
e365e51a2b Render all visible cursors 2014-04-22 17:09:03 -06:00
Nathan Sobo
70e5880b1d Start on cursor rendering 2014-04-22 17:09:02 -06:00
Nathan Sobo
958bc638d7 Improve scrolling performance 2014-04-22 17:09:02 -06:00
Nathan Sobo
a134a60ce8 Render the entire editor with React. Handle vertical scrolling.
The space-pen view is now a simple wrapper around the entire React
component to integrate it cleanly into our existing system. React
components can't adopt existing DOM nodes, otherwise I would just have
the react component take over the entire view instead of wrapping.
2014-04-22 17:09:02 -06:00