This commit is contained in:
Fabian Jakobs 2011-08-12 09:57:40 +02:00
commit 7d3b728f3a
6 changed files with 45 additions and 27 deletions

View file

@ -9449,20 +9449,23 @@ var Editor =function(renderer, session) {
}; };
this.getCopyText = function() { this.getCopyText = function() {
if (!this.selection.isEmpty()) { var text = "";
return this.session.getTextRange(this.getSelectionRange()); if (!this.selection.isEmpty())
} text = this.session.getTextRange(this.getSelectionRange());
else {
return ""; this._emit("copy", text);
} return text;
}; };
this.onCut = function() { this.onCut = function() {
if (this.$readOnly) if (this.$readOnly)
return; return;
var range = this.getSelectionRange();
this._emit("cut", range);
if (!this.selection.isEmpty()) { if (!this.selection.isEmpty()) {
this.session.remove(this.getSelectionRange()) this.session.remove(range)
this.clearSelection(); this.clearSelection();
} }
}; };
@ -9565,6 +9568,9 @@ var Editor =function(renderer, session) {
}; };
this.onTextInput = function(text, notPasted) { this.onTextInput = function(text, notPasted) {
if (!notPasted)
this._emit("paste", text);
// In case the text was not pasted and we got only one character, then // In case the text was not pasted and we got only one character, then
// handel it as a command key stroke. // handel it as a command key stroke.
if (notPasted && text.length == 1) { if (notPasted && text.length == 1) {
@ -9870,7 +9876,7 @@ var Editor =function(renderer, session) {
var range = new Range(rows.first, 0, rows.last+1, 0) var range = new Range(rows.first, 0, rows.last+1, 0)
else else
var range = new Range( var range = new Range(
rows.first-1, this.session.getLine(rows.first).length, rows.first-1, this.session.getLine(rows.first-1).length,
rows.last, this.session.getLine(rows.last).length rows.last, this.session.getLine(rows.last).length
); );
this.session.remove(range); this.session.remove(range);

File diff suppressed because one or more lines are too long

View file

@ -5849,20 +5849,23 @@ var Editor =function(renderer, session) {
}; };
this.getCopyText = function() { this.getCopyText = function() {
if (!this.selection.isEmpty()) { var text = "";
return this.session.getTextRange(this.getSelectionRange()); if (!this.selection.isEmpty())
} text = this.session.getTextRange(this.getSelectionRange());
else {
return ""; this._emit("copy", text);
} return text;
}; };
this.onCut = function() { this.onCut = function() {
if (this.$readOnly) if (this.$readOnly)
return; return;
var range = this.getSelectionRange();
this._emit("cut", range);
if (!this.selection.isEmpty()) { if (!this.selection.isEmpty()) {
this.session.remove(this.getSelectionRange()) this.session.remove(range)
this.clearSelection(); this.clearSelection();
} }
}; };
@ -5965,6 +5968,9 @@ var Editor =function(renderer, session) {
}; };
this.onTextInput = function(text, notPasted) { this.onTextInput = function(text, notPasted) {
if (!notPasted)
this._emit("paste", text);
// In case the text was not pasted and we got only one character, then // In case the text was not pasted and we got only one character, then
// handel it as a command key stroke. // handel it as a command key stroke.
if (notPasted && text.length == 1) { if (notPasted && text.length == 1) {
@ -6270,7 +6276,7 @@ var Editor =function(renderer, session) {
var range = new Range(rows.first, 0, rows.last+1, 0) var range = new Range(rows.first, 0, rows.last+1, 0)
else else
var range = new Range( var range = new Range(
rows.first-1, this.session.getLine(rows.first).length, rows.first-1, this.session.getLine(rows.first-1).length,
rows.last, this.session.getLine(rows.last).length rows.last, this.session.getLine(rows.last).length
); );
this.session.remove(range); this.session.remove(range);

File diff suppressed because one or more lines are too long

View file

@ -5838,20 +5838,23 @@ var Editor =function(renderer, session) {
}; };
this.getCopyText = function() { this.getCopyText = function() {
if (!this.selection.isEmpty()) { var text = "";
return this.session.getTextRange(this.getSelectionRange()); if (!this.selection.isEmpty())
} text = this.session.getTextRange(this.getSelectionRange());
else {
return ""; this._emit("copy", text);
} return text;
}; };
this.onCut = function() { this.onCut = function() {
if (this.$readOnly) if (this.$readOnly)
return; return;
var range = this.getSelectionRange();
this._emit("cut", range);
if (!this.selection.isEmpty()) { if (!this.selection.isEmpty()) {
this.session.remove(this.getSelectionRange()) this.session.remove(range)
this.clearSelection(); this.clearSelection();
} }
}; };
@ -5954,6 +5957,9 @@ var Editor =function(renderer, session) {
}; };
this.onTextInput = function(text, notPasted) { this.onTextInput = function(text, notPasted) {
if (!notPasted)
this._emit("paste", text);
// In case the text was not pasted and we got only one character, then // In case the text was not pasted and we got only one character, then
// handel it as a command key stroke. // handel it as a command key stroke.
if (notPasted && text.length == 1) { if (notPasted && text.length == 1) {
@ -6259,7 +6265,7 @@ var Editor =function(renderer, session) {
var range = new Range(rows.first, 0, rows.last+1, 0) var range = new Range(rows.first, 0, rows.last+1, 0)
else else
var range = new Range( var range = new Range(
rows.first-1, this.session.getLine(rows.first).length, rows.first-1, this.session.getLine(rows.first-1).length,
rows.last, this.session.getLine(rows.last).length rows.last, this.session.getLine(rows.last).length
); );
this.session.remove(range); this.session.remove(range);

File diff suppressed because one or more lines are too long