##// END OF EJS Templates
handle somehting selected and multiple cursors and 4 tabs show content in pager
Matthias Bussonnier -
Show More
@@ -230,7 +230,7 b' define(['
230 event.preventDefault();
230 event.preventDefault();
231 return true;
231 return true;
232 } else if (event.keyCode === keycodes.tab && event.type === 'keydown' && event.shiftKey) {
232 } else if (event.keyCode === keycodes.tab && event.type === 'keydown' && event.shiftKey) {
233 if (editor.somethingSelected()){
233 if (editor.somethingSelected() || editor.getSelections().length !== 1){
234 var anchor = editor.getCursor("anchor");
234 var anchor = editor.getCursor("anchor");
235 var head = editor.getCursor("head");
235 var head = editor.getCursor("head");
236 if( anchor.line != head.line){
236 if( anchor.line != head.line){
@@ -244,7 +244,9 b' define(['
244 } else if (event.keyCode === keycodes.tab && event.type == 'keydown') {
244 } else if (event.keyCode === keycodes.tab && event.type == 'keydown') {
245 // Tab completion.
245 // Tab completion.
246 this.tooltip.remove_and_cancel_tooltip();
246 this.tooltip.remove_and_cancel_tooltip();
247 if (editor.somethingSelected()) {
247
248 // completion does not work on multicursor, it might be possible though in some cases
249 if (editor.somethingSelected() || editor.getSelections().length > 1) {
248 return false;
250 return false;
249 }
251 }
250 var pre_cursor = editor.getRange({line:cur.line,ch:0},cur);
252 var pre_cursor = editor.getRange({line:cur.line,ch:0},cur);
@@ -94,7 +94,7 b' define(['
94 Completer.prototype.startCompletion = function () {
94 Completer.prototype.startCompletion = function () {
95 // call for a 'first' completion, that will set the editor and do some
95 // call for a 'first' completion, that will set the editor and do some
96 // special behavior like autopicking if only one completion available.
96 // special behavior like autopicking if only one completion available.
97 if (this.editor.somethingSelected()) return;
97 if (this.editor.somethingSelected()|| this.editor.getSelections().length > 1) return;
98 this.done = false;
98 this.done = false;
99 // use to get focus back on opera
99 // use to get focus back on opera
100 this.carry_on_completion(true);
100 this.carry_on_completion(true);
@@ -143,7 +143,7 b' define(['
143 }
143 }
144
144
145 // We want a single cursor position.
145 // We want a single cursor position.
146 if (this.editor.somethingSelected()) {
146 if (this.editor.somethingSelected()|| editor.getSelections().length > 1) {
147 return;
147 return;
148 }
148 }
149
149
@@ -117,8 +117,7 b' define(['
117
117
118 Tooltip.prototype.showInPager = function (cell) {
118 Tooltip.prototype.showInPager = function (cell) {
119 // reexecute last call in pager by appending ? to show back in pager
119 // reexecute last call in pager by appending ? to show back in pager
120 var that = this;
120 this.events.trigger('open_with_text.Pager', this._reply.content);
121 this.events.trigger('open_with_text.Pager', that._reply.content);
122 this.remove_and_cancel_tooltip();
121 this.remove_and_cancel_tooltip();
123 };
122 };
124
123
@@ -208,7 +207,7 b' define(['
208 var msg_id = cell.kernel.inspect(text, cursor_pos, callbacks);
207 var msg_id = cell.kernel.inspect(text, cursor_pos, callbacks);
209 };
208 };
210
209
211 // make an imediate completion request
210 // make an immediate completion request
212 Tooltip.prototype.request = function (cell, hide_if_no_docstring) {
211 Tooltip.prototype.request = function (cell, hide_if_no_docstring) {
213 // request(codecell)
212 // request(codecell)
214 // Deal with extracting the text from the cell and counting
213 // Deal with extracting the text from the cell and counting
@@ -222,10 +221,11 b' define(['
222 this._hide_if_no_docstring = hide_if_no_docstring;
221 this._hide_if_no_docstring = hide_if_no_docstring;
223
222
224 if(editor.somethingSelected()){
223 if(editor.somethingSelected()){
224 // get only the most recent selection.
225 text = editor.getSelection();
225 text = editor.getSelection();
226 }
226 }
227
227
228 // need a permanent handel to code_mirror for future auto recall
228 // need a permanent handle to code_mirror for future auto recall
229 this.code_mirror = editor;
229 this.code_mirror = editor;
230
230
231 // now we treat the different number of keypress
231 // now we treat the different number of keypress
@@ -325,7 +325,7 b' define(['
325 this.text.scrollTop(0);
325 this.text.scrollTop(0);
326 };
326 };
327
327
328 // Backwards compatability.
328 // Backwards compatibility.
329 IPython.Tooltip = Tooltip;
329 IPython.Tooltip = Tooltip;
330
330
331 return {'Tooltip': Tooltip};
331 return {'Tooltip': Tooltip};
General Comments 0
You need to be logged in to leave comments. Login now