-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
band-aid for completion #5112
band-aid for completion #5112
Conversation
Unlike @Carreau's attempt at using proper CodeMirror completion, this is just a band-aid to get the existing completion back to working for 2.0. This adds a keypress handler on the completer, which then calls insert with the charCode of the key press event, replacing the final `elif` branch of the keydown handler. This cannot be done with keydown, since keydown doesn't know what character is incoming, only the hardware key that is struck.
I am not super confident about this implementation, but it seems to work and I don't know how to write tests for it. If other folks could play with it and confirm that I didn't break everything, or at least that it's net less broken than master, that would be very helpful. |
Hey @minrk I'm trying to test this branch for you right now but I'm a little confused about what exactly this fixes. |
@jdfreder : I believe that typing while the completer is open currently doesn't work in master. |
@takluyver thanks for clarifying, that was it. |
Linked to #4860 |
|
||
// if empty result return | ||
if (!this.raw_result || !this.raw_result.length) return; | ||
|
||
// When there is only one completion, use it directly. | ||
if (this.autopick == true && this.raw_result.length == 1) { | ||
if (this.autopick && this.raw_result.length == 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
=== 1
I am in favor of this approach to fixing the bug for 2.0. I have verified that it does fix the issue. |
thanks for the heads-up, will test now. |
Yup, confirming here that it does indeed improve things. Many thanks!! Merging now. |
Band-aid for completion in the notebook: not the ideal solution, but will have to do the job for now so that typing while completing works. closes #4860
Band-aid for completion in the notebook: not the ideal solution, but will have to do the job for now so that typing while completing works. closes ipython#4860
Unlike @Carreau's attempt at using proper CodeMirror completion, this is just a band-aid to get the existing completion back to working for 2.0.
This adds a keypress handler on the completer, which then calls insert with the charCode of the event, replacing the final
elif
branch of the keydown handler.This cannot be done with keydown, since keydown doesn't know what character is incoming, only the hardware key that is struck.
closes #4860