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

Commit

Permalink
Merge pull request #2611 from adobe/rlim/code-hints-issues
Browse files Browse the repository at this point in the history
Don't update hint list with changes from the program (like those from hint insertion).
  • Loading branch information
joelrbrandt committed Jan 20, 2013
2 parents eca3a51 + e2a2c3d commit c87ec6f
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/editor/CodeHintManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,8 @@ define(function (require, exports, module) {
// End the session if the user presses any key with a modifier (other than Ctrl+Space).
_endSession();
} else if (event.keyCode === KeyEvent.DOM_VK_LEFT ||
event.keyCode === KeyEvent.DOM_VK_RIGHT) {
event.keyCode === KeyEvent.DOM_VK_RIGHT ||
event.keyCode === KeyEvent.DOM_VK_BACK_SPACE) {
// Update the list after a simple navigation.
// We do this in "keyup" because we want the cursor position to be updated before
// we redraw the list.
Expand All @@ -481,10 +482,20 @@ define(function (require, exports, module) {
* the lastChar.
*/
function handleChange(editor) {
if (_inSession(editor)) {
_updateHintList();
} else {
if (lastChar) {
if (lastChar) {
if (_inSession(editor)) {
var charToRetest = lastChar;
_updateHintList();

// _updateHintList() may end a hinting session and clear lastChar, but a
// different provider may want to start a new session with the same character.
// So check whether current provider terminates the current hinting
// session. If so, then restore lastChar and restart a new session.
if (!_inSession(editor)) {
lastChar = charToRetest;
_beginSession(editor);
}
} else {
_beginSession(editor);
}
}
Expand Down

0 comments on commit c87ec6f

Please # to comment.