Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use selection polling to update editor.range #431

Merged
merged 1 commit into from
Jul 15, 2016
Merged

Conversation

bantic
Copy link
Collaborator

@bantic bantic commented Jul 5, 2016

SelectionChangeObserver maintains a singleton instance that polls the
window using requestAnimationFrame for changes to the selection.
Editors' EventManager instances use a SelectionManager to listen for
selectionchanged events, and update the editor's range if necessary.

Removes code that would use some keyup events (when key.isMovement())
and mouseup events to detect when the range could have changed.

The range-detection code was previously spread out over EventManager,
Editor, Cursor and EditState. This code change consolidates most
of the responsibility for knowing/reading/updating the editor's range
o its EditState instance. The editor now delegates range to the edit
state instance, and the edit state instance is responsible for knowing
when the editor's inputMode or range has changed.

Some tests assumed selection changes would be picked up synchronously;
for those tests a Helpers.wait helper is added that schedules a
callback with requestAnimationFrame.

Also:

  • use "hidepassed" for sauce tests to improve test failure debugging

fixes #408
fixes #383
related #369
related #302

@bantic bantic force-pushed the use-selection-polling branch 4 times, most recently from 318ebe7 to 20e6077 Compare July 7, 2016 21:46
@bantic bantic changed the title WIP Use selection polling Use selection polling to update editor.range Jul 7, 2016
@bantic bantic force-pushed the use-selection-polling branch 5 times, most recently from 9dbe972 to 4faf0ef Compare July 9, 2016 17:45
SelectionChangeObserver maintains a singleton instance that polls the
window using `requestAnimationFrame` for changes to the selection.
Editors' EventManager instances use a SelectionManager to listen for
`selectionchanged` events, and update the editor's `range` if necessary.

Removes code that would use some keyup events (when `key.isMovement()`)
and `mouseup` events to detect when the range could have changed.

The range-detection code was previously spread out over `EventManager`,
`Editor`, `Cursor` and `EditState`. This code change consolidates most
of the responsibility for knowing/reading/updating the editor's `range`
o its `EditState` instance. The editor now delegates `range` to the edit
state instance, and the edit state instance is responsible for knowing
when the editor's inputMode or range has changed.

Some tests assumed selection changes would be picked up synchronously;
for those tests a `Helpers.wait` helper is added that schedules a
callback with `requestAnimationFrame`.

Also:
 * use "hidepassed" for sauce tests to improve test failure debugging
 * remove unused `editor.selectSections`
 * remove now-unnecessary key commands for meta+arrow on mac
@bantic bantic merged commit 2fedd14 into master Jul 15, 2016
@bantic bantic deleted the use-selection-polling branch July 15, 2016 17:44
@bantic
Copy link
Collaborator Author

bantic commented Jul 15, 2016

released in v0.10.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using CMD+DownArrow produces unexpected results cursor movement on mac with META+[SHIFT]+ARROW
1 participant