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

Detect pending text insertion when inserting from hint list #5228

Merged
merged 5 commits into from
Sep 28, 2013

Conversation

redmunds
Copy link
Contributor

This is for #5003.

CodeHintList now keeps track of pending text insertions so it can make a better decision about when to insert when it receives an Enter key.

} else {
// ...resulting text doesn't match anything in list, so
// let the event bubble.
return false;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the case described in #5003 -- resulting text after pending text insertion does not exist in hint list.

@ghost ghost assigned RaymondLim Sep 17, 2013
};

/**
* Rebuilds the list items for the hint list.
Copy link
Contributor

Choose a reason for hiding this comment

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

Incorrect description. You forgot to update after you duplicated it from the function below this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@redmunds
Copy link
Contributor Author

@RaymondLim I pushed changes for all of your comments so far. I also found and fixed a typo that I copied and pasted in several places :)

I am still not sure about the question I asked about CodeHintList.js line 437, so don't merge yet. I was planning to ask in next standup meeting.

hintList.some(function (listItem, index) {
if (listItem[0].innerText.indexOf(itemText) === 0) {
found = true;
return true;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you want to return 'found' here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need to return true; here to exit some() method when item is found, otherwise code loops through all elements. Code could be more explicit and return false; in else case.

Value of found gets returned from outer function.

Actually, I'm hoping that we decide to implement a simpler fix and this function will get removed, anyway.

@redmunds
Copy link
Contributor Author

Pushed changed for a much simpler fix. See comment in CodeHintList.js line 409 for details. This simplified fix means that there are no changes to HintProvider code, but I did leave in some cleanup I did to the comments -- let me know if I should remove those. Ready for another review.

@@ -165,8 +167,7 @@ define(function (require, exports, module) {
return {
hints: formattedHints,
match: null, // the CodeHintManager should not format the results
selectInitial: true,
handleWideResults: hints.handleWideResults
Copy link
Contributor

Choose a reason for hiding this comment

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

Oops... you're removing something that was intentionally added to widen the code hints list. And I think you should also put back your documentation changes (in CodeHintmanger.js) for this extra property even though it is only used in JS code hints.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! Fixed.

@RaymondLim
Copy link
Contributor

Done with the review. Just have one comment regarding the handleWideResults property.

@redmunds
Copy link
Contributor Author

I restored handleWideResults documentation and code. Ready for re-review.

@RaymondLim
Copy link
Contributor

Looks good. Merging.

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.

3 participants