This commit is contained in:
Sergi Mansilla 2011-11-25 11:30:31 +01:00
commit 0ca443966e
7 changed files with 79 additions and 25 deletions

View file

@ -6608,6 +6608,17 @@ var EditSession = function(text, mode) {
return new Range(row, start, row, end); return new Range(row, start, row, end);
}; };
// Gets the range of a word including its right whitespace
this.getAWordRange = function(row, column) {
var wordRange = this.getWordRange(row, column);
var line = this.getLine(wordRange.end.row);
while (line.charAt(wordRange.end.column).match(/[ \t]/)) {
wordRange.end.column += 1;
}
return wordRange;
};
this.setNewLineMode = function(newLineMode) { this.setNewLineMode = function(newLineMode) {
this.doc.setNewLineMode(newLineMode); this.doc.setNewLineMode(newLineMode);
}; };
@ -8074,6 +8085,13 @@ var Selection = function(session) {
this.setSelectionRange(range); this.setSelectionRange(range);
}; };
// Selects a word including its right whitespace
this.selectAWord = function() {
var cursor = this.getCursor();
var range = this.session.getAWordRange(cursor.row, cursor.column);
this.setSelectionRange(range);
};
this.selectLine = function() { this.selectLine = function() {
var rowStart = this.selectionLead.row; var rowStart = this.selectionLead.row;
var rowEnd; var rowEnd;

File diff suppressed because one or more lines are too long

View file

@ -11,7 +11,7 @@
Ace Ace
version 0.2.0 version 0.2.0
commit 219d337db34951e44d1484979918a3030901dd0c commit 7e84cef35b033d0d159560f3959737318db514ac
--> -->

View file

@ -5748,6 +5748,17 @@ var EditSession = function(text, mode) {
return new Range(row, start, row, end); return new Range(row, start, row, end);
}; };
// Gets the range of a word including its right whitespace
this.getAWordRange = function(row, column) {
var wordRange = this.getWordRange(row, column);
var line = this.getLine(wordRange.end.row);
while (line.charAt(wordRange.end.column).match(/[ \t]/)) {
wordRange.end.column += 1;
}
return wordRange;
};
this.setNewLineMode = function(newLineMode) { this.setNewLineMode = function(newLineMode) {
this.doc.setNewLineMode(newLineMode); this.doc.setNewLineMode(newLineMode);
}; };
@ -7214,6 +7225,13 @@ var Selection = function(session) {
this.setSelectionRange(range); this.setSelectionRange(range);
}; };
// Selects a word including its right whitespace
this.selectAWord = function() {
var cursor = this.getCursor();
var range = this.session.getAWordRange(cursor.row, cursor.column);
this.setSelectionRange(range);
};
this.selectLine = function() { this.selectLine = function() {
var rowStart = this.selectionLead.row; var rowStart = this.selectionLead.row;
var rowEnd; var rowEnd;

File diff suppressed because one or more lines are too long

View file

@ -5702,6 +5702,17 @@ var EditSession = function(text, mode) {
return new Range(row, start, row, end); return new Range(row, start, row, end);
}; };
// Gets the range of a word including its right whitespace
this.getAWordRange = function(row, column) {
var wordRange = this.getWordRange(row, column);
var line = this.getLine(wordRange.end.row);
while (line.charAt(wordRange.end.column).match(/[ \t]/)) {
wordRange.end.column += 1;
}
return wordRange;
};
this.setNewLineMode = function(newLineMode) { this.setNewLineMode = function(newLineMode) {
this.doc.setNewLineMode(newLineMode); this.doc.setNewLineMode(newLineMode);
}; };
@ -7168,6 +7179,13 @@ var Selection = function(session) {
this.setSelectionRange(range); this.setSelectionRange(range);
}; };
// Selects a word including its right whitespace
this.selectAWord = function() {
var cursor = this.getCursor();
var range = this.session.getAWordRange(cursor.row, cursor.column);
this.setSelectionRange(range);
};
this.selectLine = function() { this.selectLine = function() {
var rowStart = this.selectionLead.row; var rowStart = this.selectionLead.row;
var rowEnd; var rowEnd;

File diff suppressed because one or more lines are too long