A single tab-completion match is now automatically selected.

pull/37/head
Brian E. Granger 15 years ago
parent e445ad1796
commit 60147f495f

@ -220,7 +220,7 @@ class NotebookManager(LoggingConfigurable):
else:
i = i+1
notebook_id = self.new_notebook_id(name)
nb = current.new_notebook(name=name, id=notebook_id)
nb = current.new_notebook(name=name)
with open(path,'w') as f:
current.write(nb, f, u'xml')
return notebook_id

@ -94,6 +94,21 @@ var IPython = (function (IPython) {
var that = this;
var cur = this.completion_cursor;
var insert = function (selected_text) {
that.code_mirror.replaceRange(
selected_text,
{line: cur.line, ch: (cur.ch-matched_text.length)},
{line: cur.line, ch: cur.ch}
);
};
if (matches.length === 1) {
insert(matches[0]);
setTimeout(function(){that.code_mirror.focus();}, 50);
return;
};
var complete = $('<div/>').addClass('completions');
var select = $('<select/>').attr('multiple','true');
for (var i=0; i<matches.length; ++i) {
@ -109,14 +124,6 @@ var IPython = (function (IPython) {
$('body').append(complete);
var done = false;
var insert = function (selected_text) {
that.code_mirror.replaceRange(
selected_text,
{line: cur.line, ch: (cur.ch-matched_text.length)},
{line: cur.line, ch: cur.ch}
);
};
var close = function () {
if (done) return;
done = true;

@ -127,7 +127,6 @@ var IPython = (function (IPython) {
TextCell.prototype.fromJSON = function (data) {
console.log(data);
if (data.cell_type === this.cell_type) {
if (data.source !== undefined) {
this.set_source(data.source);

Loading…
Cancel
Save