Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

CodeHintList shouldn't get keyboard events if closed #2530

Merged
merged 1 commit into from
Jan 14, 2013

Conversation

iwehrman
Copy link
Contributor

If a code hint provider initially (upon hinting session creation) returns deferred hints, the CodeHintList is not opened until those deferred hints have resolved to an actual list of hints. Until this resolution, the CodeHintManager should not forward keyboard events to the CodeHintList, which captures some navigation events to handle scrolling and paging through the list. This tiny pull request just ensures that the CodeHintList is actually open, and not just in a hinting session, before the CodeHintManager passes it any keyboard events.

…e resolved and the hint list is actually open
@ghost ghost assigned redmunds Jan 13, 2013
@@ -447,7 +447,7 @@ define(function (require, exports, module) {
}
// Begin a new explicit session
_beginSession(editor);
} else if (_inSession(editor)) {
} else if (_inSession(editor) && hintList.isOpen()) {
// Pass event to the hint list, if it's open
hintList.handleKeyEvent(event);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent timing! I've been reviewing the CSS code hinting pull request by @zoufahl and this fix needs one more change to set lastChar:

            } else {
                lastChar = String.fromCharCode(event.keyCode);
            }

Note that this uses event.keyCode (not event.charCode).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the problem that the extra assignment is for? Should there be a separate issue? And might there be a problem with passing a keyCode where a charCode is expected?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right -- this is not really related to the bug you're fixing. We'll fix it in the other branch.

FYI, I used keyCode because charCode is 0 for Tab and Enter.

@redmunds
Copy link
Contributor

Done with review.

@redmunds
Copy link
Contributor

Looks good. Merging.

redmunds added a commit that referenced this pull request Jan 14, 2013
…gfix

CodeHintList shouldn't get keyboard events if closed
@redmunds redmunds merged commit 9007841 into adobe:master Jan 14, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants