Show More
@@ -45,13 +45,23 var IPython = (function (IPython) { | |||
|
45 | 45 | if (event.keyCode === 13 && event.shiftKey) { |
|
46 | 46 | // Always ignore shift-enter in CodeMirror as we handle it. |
|
47 | 47 | return true; |
|
48 | } else if (event.keyCode == 32 && (event.ctrlKey || event.metaKey) && !event.altKey) { | |
|
49 | event.stop(); | |
|
48 | // } else if (event.keyCode == 32 && (event.ctrlKey || event.metaKey) && !event.altKey) { | |
|
49 | } else if (event.keyCode == 9) { | |
|
50 | 50 | var cur = editor.getCursor(); |
|
51 |
var |
|
|
52 | this.is_completing = true; | |
|
53 | this.completion_cursor = cur; | |
|
54 | IPython.notebook.complete_cell(this, line, cur.ch); | |
|
51 | var pre_cursor = editor.getRange({line:cur.line,ch:0},cur).trim(); | |
|
52 | if (pre_cursor === "") { | |
|
53 | // Don't autocomplete if the part of the line before the cursor is empty. | |
|
54 | // In this case, let CodeMirror handle indentation. | |
|
55 | return false; | |
|
56 | } else { | |
|
57 | // Autocomplete the current line. | |
|
58 | event.stop(); | |
|
59 | var line = editor.getLine(cur.line); | |
|
60 | this.is_completing = true; | |
|
61 | this.completion_cursor = cur; | |
|
62 | IPython.notebook.complete_cell(this, line, cur.ch); | |
|
63 | return true; | |
|
64 | } | |
|
55 | 65 | } else { |
|
56 | 66 | if (this.is_completing && this.completion_cursor !== editor.getCursor()) { |
|
57 | 67 | this.is_completing = false; |
General Comments 0
You need to be logged in to leave comments.
Login now