package
This commit is contained in:
parent
7e84cef35b
commit
0ca443966e
7 changed files with 79 additions and 25 deletions
|
|
@ -6608,6 +6608,17 @@ var EditSession = function(text, mode) {
|
|||
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.doc.setNewLineMode(newLineMode);
|
||||
};
|
||||
|
|
@ -7866,11 +7877,11 @@ var Range = require("./range").Range;
|
|||
|
||||
/**
|
||||
* Keeps cursor position and the text selection of an edit session.
|
||||
*
|
||||
*
|
||||
* The row/columns used in the selection are in document coordinates
|
||||
* representing ths coordinates as thez appear in the document
|
||||
* before applying soft wrap and folding.
|
||||
*/
|
||||
*/
|
||||
var Selection = function(session) {
|
||||
this.session = session;
|
||||
this.doc = session.getDocument();
|
||||
|
|
@ -7944,7 +7955,7 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
var anchor = this.getSelectionAnchor();
|
||||
var lead = this.getSelectionLead();
|
||||
var lead = this.getSelectionLead();
|
||||
|
||||
var isBackwards = this.isBackwards();
|
||||
|
||||
|
|
@ -8074,6 +8085,13 @@ var Selection = function(session) {
|
|||
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() {
|
||||
var rowStart = this.selectionLead.row;
|
||||
var rowEnd;
|
||||
|
|
@ -8261,10 +8279,10 @@ var Selection = function(session) {
|
|||
this.selectionLead.row,
|
||||
this.selectionLead.column
|
||||
);
|
||||
|
||||
|
||||
var screenCol = (chars === 0 && this.$desiredColumn) || screenPos.column;
|
||||
var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenCol);
|
||||
|
||||
|
||||
// move the cursor and update the desired column
|
||||
this.moveCursorTo(docPos.row, docPos.column + chars, chars === 0);
|
||||
};
|
||||
|
|
@ -8280,11 +8298,11 @@ var Selection = function(session) {
|
|||
row = fold.start.row;
|
||||
column = fold.start.column;
|
||||
}
|
||||
|
||||
|
||||
this.$preventUpdateDesiredColumnOnChange = true;
|
||||
this.selectionLead.setPosition(row, column);
|
||||
this.$preventUpdateDesiredColumnOnChange = false;
|
||||
|
||||
|
||||
if (!preventUpdateDesiredColumn)
|
||||
this.$updateDesiredColumn(this.selectionLead.column);
|
||||
};
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
Ace
|
||||
version 0.2.0
|
||||
commit 219d337db34951e44d1484979918a3030901dd0c
|
||||
commit 7e84cef35b033d0d159560f3959737318db514ac
|
||||
|
||||
|
||||
-->
|
||||
|
|
|
|||
|
|
@ -5748,6 +5748,17 @@ var EditSession = function(text, mode) {
|
|||
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.doc.setNewLineMode(newLineMode);
|
||||
};
|
||||
|
|
@ -7006,11 +7017,11 @@ var Range = require("./range").Range;
|
|||
|
||||
/**
|
||||
* Keeps cursor position and the text selection of an edit session.
|
||||
*
|
||||
*
|
||||
* The row/columns used in the selection are in document coordinates
|
||||
* representing ths coordinates as thez appear in the document
|
||||
* before applying soft wrap and folding.
|
||||
*/
|
||||
*/
|
||||
var Selection = function(session) {
|
||||
this.session = session;
|
||||
this.doc = session.getDocument();
|
||||
|
|
@ -7084,7 +7095,7 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
var anchor = this.getSelectionAnchor();
|
||||
var lead = this.getSelectionLead();
|
||||
var lead = this.getSelectionLead();
|
||||
|
||||
var isBackwards = this.isBackwards();
|
||||
|
||||
|
|
@ -7214,6 +7225,13 @@ var Selection = function(session) {
|
|||
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() {
|
||||
var rowStart = this.selectionLead.row;
|
||||
var rowEnd;
|
||||
|
|
@ -7401,10 +7419,10 @@ var Selection = function(session) {
|
|||
this.selectionLead.row,
|
||||
this.selectionLead.column
|
||||
);
|
||||
|
||||
|
||||
var screenCol = (chars === 0 && this.$desiredColumn) || screenPos.column;
|
||||
var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenCol);
|
||||
|
||||
|
||||
// move the cursor and update the desired column
|
||||
this.moveCursorTo(docPos.row, docPos.column + chars, chars === 0);
|
||||
};
|
||||
|
|
@ -7420,11 +7438,11 @@ var Selection = function(session) {
|
|||
row = fold.start.row;
|
||||
column = fold.start.column;
|
||||
}
|
||||
|
||||
|
||||
this.$preventUpdateDesiredColumnOnChange = true;
|
||||
this.selectionLead.setPosition(row, column);
|
||||
this.$preventUpdateDesiredColumnOnChange = false;
|
||||
|
||||
|
||||
if (!preventUpdateDesiredColumn)
|
||||
this.$updateDesiredColumn(this.selectionLead.column);
|
||||
};
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -5702,6 +5702,17 @@ var EditSession = function(text, mode) {
|
|||
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.doc.setNewLineMode(newLineMode);
|
||||
};
|
||||
|
|
@ -6960,11 +6971,11 @@ var Range = require("./range").Range;
|
|||
|
||||
/**
|
||||
* Keeps cursor position and the text selection of an edit session.
|
||||
*
|
||||
*
|
||||
* The row/columns used in the selection are in document coordinates
|
||||
* representing ths coordinates as thez appear in the document
|
||||
* before applying soft wrap and folding.
|
||||
*/
|
||||
*/
|
||||
var Selection = function(session) {
|
||||
this.session = session;
|
||||
this.doc = session.getDocument();
|
||||
|
|
@ -7038,7 +7049,7 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
var anchor = this.getSelectionAnchor();
|
||||
var lead = this.getSelectionLead();
|
||||
var lead = this.getSelectionLead();
|
||||
|
||||
var isBackwards = this.isBackwards();
|
||||
|
||||
|
|
@ -7168,6 +7179,13 @@ var Selection = function(session) {
|
|||
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() {
|
||||
var rowStart = this.selectionLead.row;
|
||||
var rowEnd;
|
||||
|
|
@ -7355,10 +7373,10 @@ var Selection = function(session) {
|
|||
this.selectionLead.row,
|
||||
this.selectionLead.column
|
||||
);
|
||||
|
||||
|
||||
var screenCol = (chars === 0 && this.$desiredColumn) || screenPos.column;
|
||||
var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenCol);
|
||||
|
||||
|
||||
// move the cursor and update the desired column
|
||||
this.moveCursorTo(docPos.row, docPos.column + chars, chars === 0);
|
||||
};
|
||||
|
|
@ -7374,11 +7392,11 @@ var Selection = function(session) {
|
|||
row = fold.start.row;
|
||||
column = fold.start.column;
|
||||
}
|
||||
|
||||
|
||||
this.$preventUpdateDesiredColumnOnChange = true;
|
||||
this.selectionLead.setPosition(row, column);
|
||||
this.$preventUpdateDesiredColumnOnChange = false;
|
||||
|
||||
|
||||
if (!preventUpdateDesiredColumn)
|
||||
this.$updateDesiredColumn(this.selectionLead.column);
|
||||
};
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue