Commit Graph

8374 Commits

Author SHA1 Message Date
Nathan Sobo
cbcc30b384 Don't render empty selections 2014-05-16 15:31:13 -06:00
Nathan Sobo
ce9fe90217 Make multi-line selections appear to span the screen with a single div
Because lines are opaque and any area of a selection that overlaps a
line is actually rendered on the line itself, the screen-spanning
background of a multi-line selection can actually be rendered as a
single div spanning the entire screen from the first row to the
penultimate row of the selection.
2014-05-16 15:31:13 -06:00
Nathan Sobo
7a9278e6a7 Render selection fragments on opaque lines
Because lines are opaque on the GPU for sub pixel antialiasing, the
lines obscure the selections which were formerly rendered behind the
lines. This commit renders selection fragments *on* each opaque line
layer so the selections look correct again. Still needs cleanup and
optimization.
2014-05-16 15:31:13 -06:00
Nathan Sobo
01622140e3 Rename renderedRowRange to visibleRowRange
We only render visible rows now, so this makes more sense.
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
63488997ee Give lines and line numbers an opaque background to support sub-pixel AA
Since lines and line numbers are now on the GPU, their text won't be
properly anti-aliased on low-resolution displays unless their layers
have a solid background.
2014-05-16 15:31:12 -06:00
Nathan Sobo
757ae6de39 Position selections relative to viewport
This is getting closer, but lines still need to be opaque. Multi-line
selections will still need to be rendered behind the line layers so they
can extend to the edge of the viewport, so this code still has value.
2014-05-16 15:31:12 -06:00
Nathan Sobo
cfc08e8b98 Allow horizontal scrolling 2014-05-16 15:31:12 -06:00
Nathan Sobo
c8e9282557 Position cursors as layers relative to the viewport 2014-05-16 15:31:11 -06:00
Nathan Sobo
a36163ce86 Manually set the gutter width to the width of a line number
We need to absolutely position line numbers to minimize repaints, but
the gutter needs to be wide enough to show them.
2014-05-16 15:31:11 -06:00
Nathan Sobo
e3d1a6aef8 Render each line number on its own layer 2014-05-16 15:31:11 -06:00
Nathan Sobo
7d8256d343 Drop lineOverdraw and scroll-view-content div 2014-05-16 15:31:11 -06:00
Nathan Sobo
bf9f8597a7 Give each line its own layer on the GPU 2014-05-16 15:31:11 -06:00
Nathan Sobo
9f2c8c1756 Measure characters in new lines when vertically scrolling stops 2014-05-16 15:31:11 -06:00
Nathan Sobo
0ae8765a8a Update scroll position directly on mousewheel events
Previously, we were updating the scrollbars and relying on an async
scroll events to fire. But updating the scrollbars is expensive, so this
updates the model directly when the next animation frame fires instead.
2014-05-16 15:31:11 -06:00
Nathan Sobo
308960309d Overdraw lines to discourage Blink from repainting the entire editor 2014-05-16 15:31:11 -06:00
Nathan Sobo
b8ac8516fe Don't preserve rows when scrolling 2014-05-16 15:31:11 -06:00
Kevin Sawicki
628ea72943 Check if selector matches parents of test element
Previously a menu for a keybinding with a .workspace selector would not
display the shortcut because the selector wasn't matching the test editor
element directly.

Now the parent elements of the test editor are checked as well.

Closes #2089
2014-05-16 11:57:04 -07:00
Kevin Sawicki
fc2830bacb Use div for test workspace element 2014-05-16 11:53:40 -07:00
David Y. Ross
e3302b3f73 hide the cursor with cursor-hidden class rather than element.style 2014-05-15 19:20:32 -07:00
Kevin Sawicki
3eadc61a3b 💄 Use trailing if 2014-05-15 10:48:02 -07:00
Kevin Sawicki
2bef7e26d7 Merge pull request #2246 from Flannelhead/master
Make ctrl+click add a new cursor in Linux and Windows, fixes #2105
2014-05-15 10:24:15 -07:00
Kevin Sawicki
7d655bf840 📝 Mention previous value is in second argument object 2014-05-15 10:16:29 -07:00
Kevin Sawicki
42c4dc6937 Merge pull request #2243 from lee-dohm/doc-fix
📝 Clean up Config::observe
2014-05-15 10:13:35 -07:00
Flannelhead
534704a32c Check for e.ctrlKey instead of e.metaKey if not on Mac. 2014-05-15 10:09:50 +03:00
Lee Dohm
37241a7919 📝 Clean up Config::observe 2014-05-14 21:15:17 -07:00
Cameron McEfee
7882ac60d8 Include Terms of Use in the help menu 2014-05-14 10:44:33 -07:00
Corey Johnson
f86280a77b Merge pull request #2170 from skardach/fix-filename-string
Cast opened paths to string
2014-05-12 22:49:24 -07:00
Corey Johnson
25f5717ccf Merge pull request #1971 from abe33/feature_proper_multiselections_copy_paste
Implements multiple selections clipboard paste
2014-05-12 11:10:37 -07:00
Stan Kardach
b4cb92af99 Fix #2152: Cast opened paths to string
path.resolve() was throwing an exception if given path was not a string.
When iterating through all given paths, each entry is casted by JS to
most suitable type and paths in form of a number (i.e. '1234') were
cast to Number, hence the bug.
2014-05-12 15:59:33 +02:00
abe33
b77ea04056 💄 Remove unnecessary double conditions 2014-05-12 00:06:01 +02:00
Stan Kardach
19c7086200 Fix #2152: Cast opened paths to string
path.resolve() was throwing an exception if given path was not a string.
When iterating through all given paths, each entry is casted by JS to
most suitable type and paths in form of a number (i.e. '1234') were
cast to Number, hence the bug.
2014-05-11 17:29:24 +02:00
Teddy Bradford
1519dda294 Remove duplicate . from default nonWordCharacters 2014-05-11 02:10:30 -04:00
Corey Johnson
14a430b939 Merge pull request #2128 from alfredxing/body-fullscreen-class
Add `fullscreen` class to body when in full screen
2014-05-09 11:36:39 -07:00
Nathan Sobo
ce5c29fb47 Base the visible lines on the height instead of the clientHeight
Because overlay scrollbars are invisible unless scrolling and even
regular scrollbars can be transparent.
2014-05-09 11:33:04 -06:00
Nathan Sobo
f0fd48202c Refresh scrollbars when overlay/classic style preferences changes 2014-05-09 11:33:04 -06:00
Nathan Sobo
d5eb8c21b2 Only refresh editor scrollbars on stylesheet changes that require it
If a stylesheet is added or removed, we check if it contains a selector
for scrollbars before refreshing anything.
2014-05-09 11:33:04 -06:00
Nathan Sobo
76b9982e04 Emit stylesheet-added/removed from ThemeManager w/ CSSStyleSheet objects
This enables subscribers to detect not just that stylesheets have
changed, but specifically how they have changed. This is used by the
React editor component to only refresh scrollbars when a stylesheet
that actually contains selectors for scrollbar elements is added or
removed.
2014-05-09 11:33:04 -06:00
Nathan Sobo
ca7f11f7d0 Default scrollbar height/width to 15 when it's measure as 0
A 0 measurement indicates that overlay scrollbars are enabled, so we
just fall back to 15px in that case so the user can hover directly over
the scrollbar to scroll.
2014-05-09 11:33:04 -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
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
b5f910ad06 Update line number padding when max digits changes 2014-05-09 11:33:03 -06:00
Nathan Sobo
e412371b88 Remove logging 2014-05-09 11:33:03 -06:00
Nathan Sobo
7b4bc16531 Fix specs that broke when accounting for horizontal scrollbar height 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