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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/editor/CodeHintManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down