Commit Graph

8068 Commits

Author SHA1 Message Date
Antonio Scandurra
91bb1e12c7 Don't autoscroll when using the mouse to add, delete or move selections 2017-09-05 15:26:54 +02:00
Antonio Scandurra
6e919e7acd Don't remeasure invalid block decorations
This fixes an uncaught exception that was being thrown after
invalidating a marker and resizing the editor.
2017-09-02 11:11:27 +02:00
Bryant Ung
96b3af143d Merge pull request #15163 from atom/fb-wb-modal-focus
Automatically manage focus for modal panels
2017-08-31 17:09:02 -07:00
Antonio Scandurra
3e10a84d49 Merge pull request #15506 from atom/as-honor-scrollbar-visible-only-when-scrolling
Honor macOS "Show scrollbars only when scrolling" setting
2017-08-31 11:29:26 +02:00
Antonio Scandurra
f85deec482 Merge pull request #15503 from atom/as-fix-invalidated-block-decoration-markers
Fix rendering of block decorations for invalid markers
2017-08-31 11:29:14 +02:00
Antonio Scandurra
12e6740c9c Merge pull request #15487 from atom/as-scroll-sensitivity
Always honor scroll intent on mousewheel
2017-08-31 11:28:16 +02:00
Antonio Scandurra
ac9cc72845 Merge pull request #15486 from atom/as-highlights-outside-of-tiles
Move highlight decorations outside of tiles
2017-08-31 11:26:15 +02:00
Bryant Ung
3bf8344519 Merge branch 'master' into fb-wb-modal-focus 2017-08-30 17:06:29 -07:00
Antonio Scandurra
50088b16c9 Honor macOS "Show scrollbars only when scrolling" setting
Previously, we were hiding scrollbars when their height/width was 0. On
macOS, however, users can decide to only show scrollbars while
scrolling, which causes Atom to detect scrollbars as being invisible
during measurements. As a result, we were mistakenly setting the
visibility property to `hidden` when this setting was on, thus
preventing users from seeing the scrollbar on scroll.

With this commit we are changing the dummy scrollbar components to only
become invisible when the content is not scrollable rather than when the
scrollbars have zero width or height.

As part of this, we have also renamed the
`is{Horizontal,Vertical}ScrollbarVisible` functions to
`canScroll{Horizontally,Vertically}`, to better express their intent.
2017-08-30 17:11:40 +02:00
Antonio Scandurra
9bf47f31cb Fix rendering of block decorations for invalid markers
Previously, when a marker became invalid we would delete the
corresponding block decoration from the DOM, without however removing it
from the `lineTopIndex`. Also, we had a similar issue when decorating a
marker that was already invalid: we would account for it in the index
without adding it to the DOM.

This commit addresses the above problems by ensuring that block
decorations are never added for invalid markers. At the same time, the
editor component will still keep track of changes on the marker that was
decorated, so that it can detect when its validity changes and render it
appropriately.
2017-08-30 14:25:20 +02:00
Max Brunsfeld
bd9570b165 Merge pull request #15446 from atom/mb-remove-runas
Use fs-admin instead of runas
2017-08-29 10:14:42 -07:00
Nathan Sobo
d016b09fb4 Merge pull request #15383 from atom/fb-wb-command-meta
[Commands] Add support for rich listener objects with first-class metadata
2017-08-29 09:54:41 -06:00
Antonio Scandurra
76e2e03139 Always honor scroll intent on mousewheel
This commit introduces a change in the way we respond to mousewheel
events. In particular, if `delta * scrollSensitivity` is less than 1 or
greater than -1, we will round it up or down in an attempt to honor the
user's scroll intent.
2017-08-29 13:39:11 +02:00
Antonio Scandurra
b486e3edda Move highlight decorations outside of tiles
As a consequence of https://github.com/atom/atom/pull/15378, we are now
able to render highlight decorations in a separate div, as opposed to
having an highlight container for each tile.

Code-wise this is much simpler, because highlights spanning multiple
tiles can be represented via a single region and don't need to be split
across the tiles they span anymore. As a byproduct, performance should
improve as well, because the number of nodes that need to be managed
should decrease significantly.

This also fixes https://github.com/atom/atom/issues/15449, and other
similar rendering artifacts, because highlight decoration DOM nodes
won't need to move between tiles anymore when their position changes.
2017-08-29 11:44:07 +02:00
Will Binns-Smith
b7c328fd59 Clean up docs and comment wording 2017-08-28 14:49:54 -07:00
Jason Rudolph
425a48bd28 Merge pull request #15438 from atom/b3-dont-move-undefined
Don't attempt to move undefined items when splitting panes
2017-08-28 15:56:22 -04:00
Max Brunsfeld
c8303d6391 Replace runas with fs-admin in CommandInstaller
Also, convert CommandInstaller to JavaScript.
2017-08-25 15:46:43 -07:00
Nathan Sobo
dfe411a1d0 Merge pull request #15420 from atom/as-ns-simplify-line-node-lookup
Simplify line node lookup
2017-08-24 14:49:48 -06:00
Linus Eriksson
27f17318d7 Don't attempt to move undefined items when splitting panes 2017-08-24 16:15:06 +02:00
Linus Eriksson
58faf475c9 Fix so all directions are tested in the specs 2017-08-24 14:49:48 +02:00
Will Binns-Smith
2ac1d54557 handleEvent -> onDidDispatch 2017-08-23 13:27:16 -07:00
Antonio Scandurra
74ae169fcc Maintain a map of line components instead of line nodes and text nodes
Other than simplifying the code, this will help us understand whether
https://github.com/atom/atom/issues/15263 might be related to a node
reuse issue.

Signed-off-by: Nathan Sobo <nathan@github.com>
2017-08-23 14:52:50 +02:00
Will Binns-Smith
128f702784 Add documentation to addModalPanel api 2017-08-22 23:14:54 -07:00
Will Binns-Smith
236065d0f6 Remove more semicolons 2017-08-22 23:10:14 -07:00
Will Binns-Smith
e8913660fa Make autoFocus opt-in 2017-08-22 23:10:14 -07:00
Will Binns-Smith
0916b4c4f0 Manage focus for modal panels
This implements automatic focus management for modal panels using the
excellent focus-trap module.

Upon being shown, modals will have their first tabbable element
automatically focused, and shifting focus with the tab key (or more
correctly the core:focus-next command) will be limited to the contents
of the modal. If the modal does not have any tabbable elements, focus()
will be sent to the panel's root element (if it implements it).

I'm happy to update this to *always* calls focus on the panel's root
element, but then modal implementers would need to handle that and
focus things on their own. I'd argue the tabbable element behavior
is more accessible though :)

This has the effect of not automatically closing most of Atom's own
modals whenever the tab key is pressed, which was an odd nonstandard
behavior, IMO.

This also automates returning focus to the element that had focus before
the modal was shown, something up until now had to be implemented in
every modal in Atom.

This likely breaks a few contracts for existing Atom packages that
create modals, but I've found this doesn't conflict behaviorally with
well-behaved modals like the command palette which implement their own
focus management (which can be removed if this lands).

Released under CC0.
2017-08-22 23:09:44 -07:00
Will Binns-Smith
9b995c68ec Normalize listeners at registration time; add tests for rich functions 2017-08-22 10:53:04 -07:00
Will Binns-Smith
3aa95d96d4 [Commands] Add support for rich listener objects with first-class metadata
This adds support for listener objects which, in addition to the existing callback listeners, can optionally provide a displayName ahead of time to avoid a potentially awkward humanized displayName.
2017-08-22 10:53:04 -07:00
Antonio Scandurra
e6b84dbb44 Test handleMouseDragUntilMouseUp 2017-08-22 14:38:05 +02:00
Nathan Sobo
5eae5ed5eb Merge pull request #15392 from atom/fb-wb-standard-env
Use standard (eslint's) 'env' field over globals
2017-08-21 09:38:34 -06:00
Nathan Sobo
08f36de7ec Merge pull request #15394 from atom/fb-wb-command-registry-js
Convert CommandRegistry to JavaScript
2017-08-21 09:35:31 -06:00
Antonio Scandurra
2f46b8e00e Put back mistakenly deleted line 2017-08-21 09:53:54 +02:00
Will Binns-Smith
ac32ffb155 Convert CommandRegistry to JavaScript
This was bootstrapped with running `decaffeinate` on both command-registry
and its spec, but involved a line-by-line eyeing and updating for idioms
and, in one case, correctness:

For some reason, copying the keys to the new dispatchedEvent in
coffeescript (command-registry.coffee:235) currently does not result in a thrown
exception, as it should when trying to write over the read-only property
`isTrusted`, so I added a check to ensure that the key did not already
exist in the new event. Moreover, other definitions of `preventDefault`,
`stopPropagation` and friends, which are also enumerable afaict, would
also overwrite the ones defined just prior (command-registry.coffee:220
and command-registry.js:325), so that check ensures we don't overwrite
those either.

Test plan: `./script/lint && ./script/test`, and a lengthy smoke test of
various commands through keybindings, command palette, and package
interfaces.

Released under CC0.
2017-08-20 20:52:43 -07:00
Will Binns-Smith
882a1924f0 Remove one-off eslint global pragmas in favor of envs 2017-08-20 19:55:00 -07:00
Nathan Sobo
3d0d1ae44e Prevent block decoration margins from collapsing during measurement
We now render a 1px high sentinel element between off-screen block
decorations before measuring them to prevent margins from collapsing.
2017-08-20 08:23:41 -06:00
Nathan Sobo
835ed10f7c Handle highlight end rows with 'before' blocks in addition to 'after' 2017-08-20 07:32:44 -06:00
Nathan Sobo
f33051da33 Fix highlight end pixel position calculation
Previously, we were calculating the position preceding block decorations
for the row following the end of the highlighted range, but that's
actually wrong. We just want the position following block decorations of
the end of the highlighted range, plus one line height. This prevents us
from incorrectly rendering the end of highlight after block decorations
that immediately follow the end of the highlighted range.
2017-08-20 07:00:50 -06:00
Antonio Scandurra
effc6d9d21 Fix line number position when block decorations are at tile boundaries
When there are block decorations, we compute a `marginTop` style for
line numbers, so that they can be aligned correctly to the corresponding
line nodes.

This commit fixes a regression in the logic that calculated the
`marginTop` value, which was failing to correctly render line numbers
when block decorations were located right before the end of a tile, or
exactly at
the beginning of it.
2017-08-19 15:40:32 +02:00
Ash Wilson
962bbd509a Merge pull request #15377 from atom/aw-async-watchpath
Async watchPath method
2017-08-18 15:51:44 -04:00
Ash Wilson
e7fcb0d079 Adjust Project root directory watching to account for async watchers 2017-08-18 09:10:20 -04:00
Nathan Sobo
44f3cf73ea Merge pull request #15374 from atom/ku-save-as-default-dir
Don't assign default path for `showSaveDialog` unless it exists
2017-08-18 06:58:29 -06:00
Ash Wilson
aa26eba678 Jasmine, not Mocha 2017-08-17 22:01:25 -04:00
Ash Wilson
6ffb3f3ff2 Test first 2017-08-17 21:59:32 -04:00
Katrina Uychaco
ff80e5905c Don't assign default path unless it exists 2017-08-17 12:20:04 -07:00
Nathan Sobo
e80658081a Merge pull request #15327 from captbaritone/accel-2
Base context menu accelerators on activeElement
2017-08-17 09:19:10 -06:00
Nathan Sobo
927fa3c9cb Merge pull request #15367 from atom/as-fix-scrollbar-visibility
Set visibility: hidden on dummy scrollbars if native ones are invisible
2017-08-17 09:17:30 -06:00
Nathan Sobo
6c20d6199f Merge pull request #15359 from atom/as-fix-folding
Fix folding for lines that contain a comment
2017-08-17 09:15:39 -06:00
Antonio Scandurra
1ffc8997d2 Set visibility: hidden on dummy scrollbars if native ones are invisible
This prevents the cursor from unexpectedly changing when approaching the
bottom/right corner of the editor with the mouse, even when no scrollbar
is being shown.
2017-08-17 15:11:32 +02:00
Antonio Scandurra
c99ac52152 Fix folding for lines that contain a comment
In attempting to optimize the performance of `isFoldableAtBufferRow` in
3c87b74, we mistakenly introduced a bug that caused lines that contained
a comment but didn't start with one to not be foldable anymore.

With this commit we are restoring the previous behavior, thus only
disabling folding for lines that start with a comment (ignoring leading
whitespaces).
2017-08-17 14:28:30 +02:00
Antonio Scandurra
1b5ed62e4f Ignore scroll requests to NaN, null or undefined positions 2017-08-17 09:17:52 +02:00