Commit Graph

15553 Commits

Author SHA1 Message Date
Nathan Sobo
9a38e8c0d1 Support scrollPastEnd option 2017-05-05 09:29:27 +02:00
Nathan Sobo
c80dbbce3c Add tests for highlight rendering 2017-05-05 09:29:27 +02:00
Nathan Sobo
3101e28459 Constrain line/line number decoration update to rendered rows 2017-05-05 09:29:27 +02:00
Nathan Sobo
eacf0d8f64 Decorate cursors via private 'cursor' decoration type
This eliminates the need to query the selections marker layer more than
once per frame, since it is already queried for highlights and line
decorations associated with the selections.
2017-05-05 09:29:27 +02:00
Nathan Sobo
a4224922a3 WIP: Add highlight decorations, but no tests yet 2017-05-05 09:29:27 +02:00
Nathan Sobo
aade501040 Refactor to unify computations related to tiles 2017-05-05 09:29:27 +02:00
Nathan Sobo
09f8a52b9d Implement special options for line and line number decorations
* onlyEmpty
* onlyNonEmpty
* onlyHead
* omitEmptyLastLine
2017-05-05 09:29:27 +02:00
Nathan Sobo
ff325c0151 Render line and line number decorations 2017-05-05 09:29:27 +02:00
Nathan Sobo
e15e7e3c96 Assign width and character dimensions on editor to update soft wraps 2017-05-05 09:29:27 +02:00
Nathan Sobo
dbbf23d3a5 Store decorations in sets instead of arrays 2017-05-05 09:29:27 +02:00
Nathan Sobo
fbf21e09d6 Remove decorationsForId from DecorationManager 2017-05-05 09:29:27 +02:00
Nathan Sobo
69d5b63e9d Replace layerUpdateDisposablesByLayerId with a weak map keyed by layer 2017-05-05 09:29:27 +02:00
Nathan Sobo
a1faf66a85 Replace decorationCountsByLayerId with a map keyed by layer 2017-05-05 09:29:27 +02:00
Nathan Sobo
18acf8bb19 Replace decorationsByMarkerLayerId with map keyed by layer 2017-05-05 09:29:27 +02:00
Nathan Sobo
acf057e002 Replace overlayDecorationsById with overlayDecorations set 2017-05-05 09:29:27 +02:00
Nathan Sobo
f426471910 Replace decorationsByMarkerId with map keyed by decoration 2017-05-05 09:29:27 +02:00
Nathan Sobo
f8a0058f06 Convert DecorationManager to standard style and remove unused method 2017-05-05 09:29:27 +02:00
Nathan Sobo
b713210b0c Emit didUpdateDecorations events synchronously
The rendering layer can be asynchronous instead, plus layer decorations
should remove the need to emit lots of individual events.
2017-05-05 09:29:27 +02:00
Nathan Sobo
30cd83f7aa Convert DecorationManager to JS 2017-05-05 09:29:27 +02:00
Nathan Sobo
3e87f9f889 Add horizontal autoscroll 2017-05-05 09:29:27 +02:00
Nathan Sobo
2ef29dee88 Refactor TextEditorComponent.prototype.updateSync 2017-05-05 09:29:27 +02:00
Nathan Sobo
51755a0f25 Don't render more line numbers than exist 2017-05-05 09:29:27 +02:00
Nathan Sobo
ed537fd61a Drop suppressLayerUpdateEvent flag
We now emit marker layer update events synchronously at the end of
transactions, so this isn't needed or supported by text-buffer.
2017-05-05 09:29:27 +02:00
Nathan Sobo
7196b05af7 Cache line number gutter properties during a single frame
These properties are somewhat expensive to compute. Since we need to
perform 2 updates per frame to perform horizontal measurement, it's good
to avoid computing the gutter properties twice since they aren't
affected by horizontal measurements in any way.
2017-05-05 09:29:27 +02:00
Nathan Sobo
38f51ce74d Extract LinesTileComponent to minimize diff/patch overhead
When typing on a single line, only a single tile needs to be updated.
When moving the cursor no tiles need to be updated.
2017-05-05 09:29:27 +02:00
Nathan Sobo
eae8e15155 Extract LineNumberGutterComponent to reduce patching 2017-05-05 09:29:27 +02:00
Nathan Sobo
c2dcc0121b Add a key to line number divs 2017-05-05 09:29:27 +02:00
Nathan Sobo
c22a81dc57 Remove logging 2017-05-05 09:29:27 +02:00
Nathan Sobo
55ed9e4f62 Pre-assign measuremets.scrollTop when autoscrolling
This avoids work when the scroll event happens asynchronously because
we'll treat the event as a no-op since the measurements didn't change.
2017-05-05 09:29:27 +02:00
Nathan Sobo
192e7c6b63 Handle direct focus of hidden input and avoid redundant focus renders 2017-05-05 09:29:27 +02:00
Nathan Sobo
b8a3e2f163 Don't clear elements owned by other components from line nodes map
We should really be recycling elements when they move between lines, but
that's a bigger project.
2017-05-05 09:29:27 +02:00
Nathan Sobo
19db16664f Don't autoscroll to impossible scrollTop locations 2017-05-05 09:29:27 +02:00
Nathan Sobo
d929720d24 Use null sentinel value for autoscrollTop to avoid bug with negatives 2017-05-05 09:29:27 +02:00
Nathan Sobo
ec045d9333 Gracefully handle focus events that occur before the attachedCallback 2017-05-05 09:29:27 +02:00
Nathan Sobo
ff2f9b192a Implement vertical autoscroll; still need tests 2017-05-05 09:29:27 +02:00
Nathan Sobo
4c51ae77dd Handle text input 2017-05-05 09:29:27 +02:00
Nathan Sobo
c52d66377f Render hidden input and handle focus and blur 2017-05-05 09:29:27 +02:00
Nathan Sobo
9487c1cd00 Move lines class 2017-05-05 09:29:27 +02:00
Nathan Sobo
b362f746f8 Fix spurious selections marker layer update to avoid extra render 2017-05-05 09:29:27 +02:00
Nathan Sobo
d780b15248 Add cursor rendering tests 2017-05-05 09:29:27 +02:00
Nathan Sobo
c8166c1bb3 Render cursors after measuring horizontal positions 2017-05-05 09:29:27 +02:00
Nathan Sobo
43386b0483 Always update twice assuming we may need to measure
This prepares the ground for measuring absoltue cursor positions.
2017-05-05 09:29:27 +02:00
Nathan Sobo
583c2c537d Iron out scheduling issues
* Ensure multiple calls to scheduleUpdate only result in a single call
to updateSync in the future.
* Explicit calls to update sync after scheduling an update fulfill the
scheduled update.
* Track whether we think the editor is visible or not to avoid redundant
didShow calls.
* Ensure we only update on resize events if the editor actually changed
size.
2017-05-05 09:29:27 +02:00
Nathan Sobo
19d1d148eb Measure the longest visible screen line on initial render 2017-05-05 09:29:27 +02:00
Nathan Sobo
ede5d5e5f4 Add coverage for gutter measurement and horizontal translation on scroll 2017-05-05 09:29:27 +02:00
Nathan Sobo
b863790390 Start on new TextEditorComponent specs; avoid excessive line numbers 2017-05-05 09:29:27 +02:00
Nathan Sobo
9765d9dbcd Translate gutter so it remains visible when scrolling to the right
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2017-05-05 09:29:27 +02:00
Nathan Sobo
d2d560eac6 Render character measurement line via virtual DOM
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2017-05-05 09:29:27 +02:00
Nathan Sobo
b38fafc83a Absolutely position line number tiles
Static positioning doesn’t seem to improve layout performance
2017-05-05 09:29:27 +02:00
Nathan Sobo
aed4d8876f Use contain: strict on line number gutter and its tiles
This improves layout time of scrolling by limiting the extent of gutter re-layouts.

Signed-off-by: Antonio Scandurra <as-cii@github.com>
2017-05-05 09:29:27 +02:00