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

Position#move isn't available on blank position #344

Closed
rlivsey opened this issue Mar 16, 2016 · 2 comments · Fixed by #353
Closed

Position#move isn't available on blank position #344

rlivsey opened this issue Mar 16, 2016 · 2 comments · Fixed by #353
Assignees

Comments

@rlivsey
Copy link
Collaborator

rlivsey commented Mar 16, 2016

If the editor handles a cursor key when the editor doesn't have focus, then editor.cursor.offsets returns a blank range, with blank position objects. These blank positions don't have a move method and sadness occurs:

screenshot 2016-03-16 00 03 18

Should we just put a guard checking that this.cursor.hasCursor() at the top of handleKeydown?

@bantic
Copy link
Collaborator

bantic commented Mar 16, 2016

@rlivsey Yes, that's a good catch. Exiting early on no cursor sounds like the right move. I will address this soon, but happy to take a PR in the meantime.

@bantic bantic self-assigned this Mar 24, 2016
@bantic
Copy link
Collaborator

bantic commented Mar 24, 2016

I'm looking at this and will fix it today

bantic added a commit that referenced this issue Mar 24, 2016
It is possible for the editor's element to be focused but not have a
cursor (selection). In this case, key events will fire on the editor's
element but the editor will not be able to determine a logical
`Position` (since there is no selection). When this happens, we abort
handling the key event.

fixes #344
bantic added a commit that referenced this issue Mar 24, 2016
It is possible for the editor's element to be focused but not have a
cursor (selection). In this case, key events will fire on the editor's
element but the editor will not be able to determine a logical
`Position` (since there is no selection). When this happens, we abort
handling the key event.

fixes #344
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 a pull request may close this issue.

2 participants