handle somehting selected and multiple cursors and 4 tabs show content in pager

pull/37/head
Matthias Bussonnier 12 years ago
parent e0f19a386e
commit dc912dbdbd

@ -230,7 +230,7 @@ define([
event.preventDefault();
return true;
} else if (event.keyCode === keycodes.tab && event.type === 'keydown' && event.shiftKey) {
if (editor.somethingSelected()){
if (editor.somethingSelected() || editor.getSelections().length !== 1){
var anchor = editor.getCursor("anchor");
var head = editor.getCursor("head");
if( anchor.line != head.line){
@ -244,7 +244,9 @@ define([
} else if (event.keyCode === keycodes.tab && event.type == 'keydown') {
// Tab completion.
this.tooltip.remove_and_cancel_tooltip();
if (editor.somethingSelected()) {
// completion does not work on multicursor, it might be possible though in some cases
if (editor.somethingSelected() || editor.getSelections().length > 1) {
return false;
}
var pre_cursor = editor.getRange({line:cur.line,ch:0},cur);

@ -94,7 +94,7 @@ define([
Completer.prototype.startCompletion = function () {
// call for a 'first' completion, that will set the editor and do some
// special behavior like autopicking if only one completion available.
if (this.editor.somethingSelected()) return;
if (this.editor.somethingSelected()|| this.editor.getSelections().length > 1) return;
this.done = false;
// use to get focus back on opera
this.carry_on_completion(true);
@ -143,7 +143,7 @@ define([
}
// We want a single cursor position.
if (this.editor.somethingSelected()) {
if (this.editor.somethingSelected()|| editor.getSelections().length > 1) {
return;
}

@ -117,8 +117,7 @@ define([
Tooltip.prototype.showInPager = function (cell) {
// reexecute last call in pager by appending ? to show back in pager
var that = this;
this.events.trigger('open_with_text.Pager', that._reply.content);
this.events.trigger('open_with_text.Pager', this._reply.content);
this.remove_and_cancel_tooltip();
};
@ -208,7 +207,7 @@ define([
var msg_id = cell.kernel.inspect(text, cursor_pos, callbacks);
};
// make an imediate completion request
// make an immediate completion request
Tooltip.prototype.request = function (cell, hide_if_no_docstring) {
// request(codecell)
// Deal with extracting the text from the cell and counting
@ -222,10 +221,11 @@ define([
this._hide_if_no_docstring = hide_if_no_docstring;
if(editor.somethingSelected()){
// get only the most recent selection.
text = editor.getSelection();
}
// need a permanent handel to code_mirror for future auto recall
// need a permanent handle to code_mirror for future auto recall
this.code_mirror = editor;
// now we treat the different number of keypress
@ -325,7 +325,7 @@ define([
this.text.scrollTop(0);
};
// Backwards compatability.
// Backwards compatibility.
IPython.Tooltip = Tooltip;
return {'Tooltip': Tooltip};

Loading…
Cancel
Save