Commit Graph

15030 Commits

Author SHA1 Message Date
David Graham & Nathan Sobo
6997adece9 Associate TokenizedLines with an ::indentLevel
This can be used to render the appropriate number of indent guide spans
for empty lines.
2014-04-22 17:09:39 -06:00
David Graham & Nathan Sobo
d0a917ed14 Prevent scrollLeft/scrollTop from going out of bounds 2014-04-22 17:09:39 -06:00
David Graham & Nathan Sobo
7fc2e0b540 Wire up the editor.showIndentGuide setting 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
6b10fcc2f8 Rely on token's knowledge of its own leading/trailing whitespace status
Previously, we were determining this at render time. But its baked into
the state of tokens when TokenizedLines are constructed now so we no
longer need to compute it when rendering.
2014-04-22 17:09:39 -06:00
David Graham & Nathan Sobo
cf27826156 Mark tokens on whitespace-only lines as having leading whitespace
This makes it easy to decide to render the indent guide for a token. If
the token has leading whitespace, we can render it.
2014-04-22 17:09:39 -06:00
David Graham & Nathan Sobo
5e38add177 Only mark trailing whitespace on the last segment of a soft-wrapped line 2014-04-22 17:09:39 -06:00
David Graham & Nathan Sobo
b4af0a79d0 Mark tokens with leading/trailing whitespace when building TokenizedLine 2014-04-22 17:09:39 -06:00
David Graham & Nathan Sobo
616b9e4b7d 💄 Rename breakOutLeadingWhitespace to breakOutLeadingSoftTabs 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
81233a696b Set default horizontalScrollMargin 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
171631d20f Autoscroll cursors horizontally at the model layer
Still need to respect the horizontal scroll position in the editor view
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
a931aaff53 Remove temporary cursor visibility styling 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
44413912bc Assign fontSize based on editor.fontSize config key 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
5c9a5cdc85 Emit 'cursors-moved' from editor when one or more cursors move 2014-04-22 17:09:37 -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
cbad8a56ec Don't start the animation loop until the mouse starts dragging
Previously, the animation loop would run multiple times prior to the
the mouseup event on click. We only want to select to the current mouse
position if the mouse is actually dragged.
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
af9355e4e6 Add Editor::getSelectedScreenRanges 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
b0ad5e2f69 💄 2014-04-22 17:09:36 -06:00
Nathan Sobo
0c960552f0 Batch updates on input events 2014-04-22 17:09:36 -06:00
Nathan Sobo
8772e96935 Temporarily remove '.editor' class from react editor wrapper
This will prevent warnings from packages during testing.
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
b879221a96 💄 Clarify variable name 2014-04-22 17:09:05 -06:00
Nathan Sobo
97a353b31a Measure each line with a fresh range
Recycling the range leads to strange timing-related measurement errors
in certain cases.
2014-04-22 17:09:05 -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
5b79bb7f66 Wait longer to clear preserved lines after mousewheel events 2014-04-22 17:09:05 -06:00
Nathan Sobo
fd2ed9a1bc Prevent scroll event feedback loops after scrolling via the model layer
When scrolling via the model layer, such as happens on autoscroll due to
moving the cursor, we update the scroll position of the fake vertical
scrollbar manually. When we receive the scroll event that results from
this, we want to do nothing. The best way to determine whether we're
getting a "real" scroll event from the user or feedback from setting
the scrollTop ourselves is to compare the scrollTop to what's in the
model. If the values are equal, there's no need to request an animation
frame to assign it. This improves performance.
2014-04-22 17:09:04 -06:00
Nathan Sobo
95bf08dfa0 Eliminate overlayer by preserving lines during mousewheel events
Previously, the overlayer served as a permanent target for mousewheel
events that would never be removed by scrolling. This is because the
velocity scrolling effect on a trackpad is implemented by repeating
events on the original mousewheel event target. If this target is
removed, the events stop repeating and the velocity effect is ruined.
Now we refrain from removing any lines until mousewheel events stop
flowing.
2014-04-22 17:09:04 -06:00
Nathan Sobo
3d3b72a954 Render selections 2014-04-22 17:09:04 -06:00
Nathan Sobo
724babdcb6 Only update vertical scrollbar's scrollTop if it has changed 2014-04-22 17:09:04 -06:00