Commit Graph

15073 Commits

Author SHA1 Message Date
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
Nathan Sobo
205e10fd09 Fix undefined variable references rendering lines 2014-04-22 17:09:41 -06:00
Nathan Sobo
ca4dd5a29a Explicitly disable use of react editor in specs 2014-04-22 17:09:41 -06:00
Nathan Sobo
2517765821 Rename 'core.useNewEditor' to 'core.useReactEditor' and default to false 2014-04-22 17:09:41 -06:00
Nathan Sobo
4b9871fa13 Enable advanced scroll management only when editor is used by react view
This preserves the original behavior of the editor model with respect
to scroll position and autoscroll unless it's being used by the react
component, which flips the ::manageScrollPosition flag to true.
2014-04-22 17:09:41 -06:00
Nathan Sobo
28dd7d4acd Treat all whitespace lines as not having leading whitespace
Instead it's treated as all trailing whitespace, as it was originally.
2014-04-22 17:09:41 -06:00
Nathan Sobo
e3eb51c135 Don't expect trailing whitespace invisibles on soft-wrapped lines
Now that trailing whitespace status of tokens is assigned at
construction time, we no longer render invisibles at the end of
soft-wrapped lines. Pretty sure this is not a behavior we wanted anyway.
2014-04-22 17:09:41 -06:00
Nathan Sobo
9ec38ddb0d Remove setInterval spy. It's now spied in the spec helper w/ setTimeout 2014-04-22 17:09:41 -06:00
Nathan Sobo
7a4dc0b9a4 Eliminate duplicate key to pass coffeelint 2014-04-22 17:09:40 -06:00
Nathan Sobo
6b4ce5f205 Add shims to get git-diff-view working 2014-04-22 17:09:40 -06:00
Nathan Sobo
9a3f8022ad Add shims to get bracket matcher working 2014-04-22 17:09:40 -06:00
Nathan Sobo
a2a625a7bb Add ReactEditorView::getPane for backward-compatibility 2014-04-22 17:09:40 -06:00
Nathan Sobo
495b1571ca Add 'editor' class to ReactEditorView wrapper for backward compatibility 2014-04-22 17:09:40 -06:00
Nathan Sobo
c862ccbc56 Add command listeners to SpacePen wrapper for backward compatibility
This is the only way to integrate with the command palette currently.
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
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