Merge pull request #3189 from juhasch/improve-completer

fix notebook completer redraw on metakey press

- set <select> tag to style="width: auto" to fit complete autocomplete string in drop down menu
- handle special keys better, so shift, ctrl, pgup, pgdown et al work as expected in the drop down list (i.e. pgup/pgdown/home/end move selection, shift, ctrl, caps lock do not restart the drop down menu)
pull/37/head
Min RK 13 years ago
commit 0a3bdf042e

@ -193,7 +193,7 @@ var IPython = (function (IPython) {
this.complete = $('<div/>').addClass('completions');
this.complete.attr('id', 'complete');
this.sel = $('<select/>').attr('multiple', 'true').attr('size', Math.min(10, this.raw_result.length));
this.sel = $('<select style="width: auto"/>').attr('multiple', 'true').attr('size', Math.min(10, this.raw_result.length));
var pos = this.editor.cursorCoords();
// TODO: I propose to remove enough horizontal pixel
@ -255,6 +255,15 @@ var IPython = (function (IPython) {
Completer.prototype.keydown = function (event) {
var code = event.keyCode;
var that = this;
var special_key = false;
// detect special keys like SHIFT,PGUP,...
for( var _key in key ) {
if (code == key[_key] ) {
special_key = true;
}
};
// Enter
if (code == key.ENTER) {
CodeMirror.e_stop(event);
@ -288,7 +297,7 @@ var IPython = (function (IPython) {
// need to do that to be able to move the arrow
// when on the first or last line ofo a code cell
event.stopPropagation();
} else if (code != key.UPARROW && code != key.DOWNARROW) {
} else if (special_key != true) {
this.close();
this.editor.focus();
//we give focus to the editor immediately and call sell in 50 ms

@ -257,6 +257,7 @@ IPython.utils = (function (IPython) {
DOWN_ARROW: 40,
DOWNARROW: 40,
DOWN : 40,
COMMAND : 91,
};

Loading…
Cancel
Save