Commit Graph

66 Commits

Author SHA1 Message Date
Nathan Sobo
5d82dcf87a Wait for content width to update before autoscrolling horizontally 2017-05-05 09:29:28 +02:00
Nathan Sobo
758466c9af Make various tweaks to improve mini editors
Still a ways to go, but this is a start toward getting the mini-editors
to play nice with our existing styling.
2017-05-05 09:29:28 +02:00
Nathan Sobo
ebad2e6605 Implement detachment to eliminate spurious drag events 2017-05-05 09:29:28 +02:00
Nathan Sobo
173cdcb372 Cache rendered screen lines on component to avoid drifting from model
The model may have screen lines that aren't yet rendered in the page,
and we want to avoid referring to them on mouse clicks.
2017-05-05 09:29:27 +02:00
Nathan Sobo
625990d22f Null guard target check to keep tests simple 2017-05-05 09:29:27 +02:00
Nathan Sobo
df4d52c89a Use constrained scroll values 2017-05-05 09:29:27 +02:00
Nathan Sobo
c2206b88da Destroy folds on fold marker click 2017-05-05 09:29:27 +02:00
Nathan Sobo
a2f75c8337 Toggle folds when clicking the arrow icon in the line number gutter 2017-05-05 09:29:27 +02:00
Nathan Sobo
cf19d0efd5 Autoscroll vertically when click-dragging the line number gutter 2017-05-05 09:29:27 +02:00
Nathan Sobo
6e9a9ef43c Add spec structure 2017-05-05 09:29:27 +02:00
Nathan Sobo
ffc2025df5 Handle clicking, shift-clicking, cmd-clicking and dragging in gutter 2017-05-05 09:29:27 +02:00
Nathan Sobo
17d579f949 Only handle the left mouse button (and middle on Linux) 2017-05-05 09:29:27 +02:00
Nathan Sobo
35ae3fb08f Implement autoscroll when mouse is dragged on content 2017-05-05 09:29:27 +02:00
Nathan Sobo
5594c9d82f Expand selections on mouse drag 2017-05-05 09:29:27 +02:00
Nathan Sobo
6bfe08e9b0 Remove cyclic requires 2017-05-05 09:29:27 +02:00
Nathan Sobo
3f4cd5e438 Correctly render cursors on reversed selections 2017-05-05 09:29:27 +02:00
Nathan Sobo
8f385377cf Make cursors render above lines 2017-05-05 09:29:27 +02:00
Nathan Sobo
4ef2119ef8 Inherit background color so line tiles get a solid background 2017-05-05 09:29:27 +02:00
Nathan Sobo
c410309827 Expand selections on shift-click 2017-05-05 09:29:27 +02:00
Nathan Sobo
35753c3a8d Add specs for single-, triple-, and cmd-clicking 2017-05-05 09:29:27 +02:00
Nathan Sobo
2996500d90 Handle double and triple click on lines 2017-05-05 09:29:27 +02:00
Nathan Sobo
fab5a93254 Set cursor position on single click 2017-05-05 09:29:27 +02:00
Nathan Sobo
88f3a5b468 WIP: Port screenPositionForPixelPosition from old LinesYardstick
Still need to port tests. This will support various mouse interactions.
2017-05-05 09:29:27 +02:00
Nathan Sobo
d7e76d9302 Remove unused event parameters 2017-05-05 09:29:27 +02:00
Nathan Sobo
ec9115e749 Skip un-accented character when undoing after using press-and-hold menu 2017-05-05 09:29:27 +02:00
Nathan Sobo
00933c7c63 Handle IME input 2017-05-05 09:29:27 +02:00
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
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
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