Update API docs

This commit is contained in:
Garen Torikian 2012-08-17 12:27:56 -07:00
commit 17fcc42923
27 changed files with 1176 additions and 1186 deletions

View file

@ -217,9 +217,7 @@
</div>
<article id="Selection" data-title="Selection (class)" class="article">
<div class="section description">
<div class="memberContent"><p>Contains the cursor position and the text selection of an edit session.
</p>
<div class="memberContent"><p>Contains the cursor position and the text selection of an edit session.</p>
<p>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.</p>
</div>
@ -241,7 +239,7 @@
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_new Selection" class="ellipsis_description"><p>Creates a new <code>Selection</code> object. ...</p>
<div id="ellipsis_new Selection" class="ellipsis_description"><p>Creates a new <code>Selection</code> object.</p>
</div>
<div id="short_new Selection" class="short_description hiddenSpan"><p>Creates a new <code>Selection</code> object.</p>
@ -271,7 +269,7 @@
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.addRange" class="ellipsis_description"><p>Adds a range to a selection by entering multiselect mode, if necessary. ...</p>
<div id="ellipsis_Selection.addRange" class="ellipsis_description"><p>Adds a range to a selection by entering multiselect mode, if necessary.</p>
</div>
<div id="short_Selection.addRange" class="short_description hiddenSpan"><p>Adds a range to a selection by entering multiselect mode, if necessary.</p>
@ -300,10 +298,10 @@
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.clearSelection" class="ellipsis_description"><p>[Empties the selection (by de-selecting it). This function also emits the <code>&#39;changeSelection&#39;</code> event.]{: #Selection.c...</p>
<div id="ellipsis_Selection.clearSelection" class="ellipsis_description"><p>[Empties the selection (by de-selecting it). This function also emits the <code>&#39;changeSelection&#39;</code> event.]{: #Selection.clearSelection}</p>
</div>
<div id="short_Selection.clearSelection" class="short_description hiddenSpan"><p>Empties the selection (by de-selecting it). This function also emits the <code>&#39;changeSelection&#39;</code> event.</p>
<div id="short_Selection.clearSelection" class="short_description hiddenSpan"><p>[Empties the selection (by de-selecting it). This function also emits the <code>&#39;changeSelection&#39;</code> event.]{: #Selection.clearSelection}</p>
</div>
<h3 id="Selection.clearSelection" class="methodToggle methodClicker inactive">&nbsp;&nbsp;&nbsp;</h3>
@ -333,7 +331,7 @@
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.getCursor" class="ellipsis_description"><p>Gets the current position of the cursor. ...</p>
<div id="ellipsis_Selection.getCursor" class="ellipsis_description"><p>Gets the current position of the cursor.</p>
</div>
<div id="short_Selection.getCursor" class="short_description hiddenSpan"><p>Gets the current position of the cursor.</p>
@ -366,10 +364,10 @@
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.getRange" class="ellipsis_description"><p>Returns the <a href="range.html#Range" class="link-short" title="Range (class)" data-id="Range"><code>Range</code></a> for the selected text.</p>
<div id="ellipsis_Selection.getRange" class="ellipsis_description"><p>[Returns the <a href="range.html#Range" class="link-short" title="Range (class)" data-id="Range">Range</a> for the selected text.]{: #Selection.getRange}</p>
</div>
<div id="short_Selection.getRange" class="short_description hiddenSpan"><p>Returns the <a href="range.html#Range" class="link-short" title="Range (class)" data-id="Range"><code>Range</code></a> for the selected text.</p>
<div id="short_Selection.getRange" class="short_description hiddenSpan"><p>[Returns the <a href="range.html#Range" class="link-short" title="Range (class)" data-id="Range">Range</a> for the selected text.]{: #Selection.getRange}</p>
</div>
<h3 id="Selection.getRange" class="methodToggle methodClicker inactive">&nbsp;&nbsp;&nbsp;</h3>
@ -400,7 +398,7 @@
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.getSelectionAnchor" class="ellipsis_description"><p>Returns an object containing the <code>row</code> and <code>column</code> of the calling selection anchor. ...</p>
<div id="ellipsis_Selection.getSelectionAnchor" class="ellipsis_description"><p>Returns an object containing the <code>row</code> and <code>column</code> of the calling selection anchor.</p>
</div>
<div id="short_Selection.getSelectionAnchor" class="short_description hiddenSpan"><p>Returns an object containing the <code>row</code> and <code>column</code> of the calling selection anchor.</p>
@ -433,7 +431,7 @@
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.getSelectionLead" class="ellipsis_description"><p>Returns an object containing the <code>row</code> and <code>column</code> of the calling selection lead. ...</p>
<div id="ellipsis_Selection.getSelectionLead" class="ellipsis_description"><p>Returns an object containing the <code>row</code> and <code>column</code> of the calling selection lead.</p>
</div>
<div id="short_Selection.getSelectionLead" class="short_description hiddenSpan"><p>Returns an object containing the <code>row</code> and <code>column</code> of the calling selection lead.</p>
@ -466,7 +464,7 @@
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.isBackwards" class="ellipsis_description"><p>Returns <code>true</code> if the selection is going backwards in the document. ...</p>
<div id="ellipsis_Selection.isBackwards" class="ellipsis_description"><p>Returns <code>true</code> if the selection is going backwards in the document.</p>
</div>
<div id="short_Selection.isBackwards" class="short_description hiddenSpan"><p>Returns <code>true</code> if the selection is going backwards in the document.</p>
@ -499,7 +497,7 @@
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.isEmpty" class="ellipsis_description"><p>Returns <code>true</code> if the selection is empty. ...</p>
<div id="ellipsis_Selection.isEmpty" class="ellipsis_description"><p>Returns <code>true</code> if the selection is empty.</p>
</div>
<div id="short_Selection.isEmpty" class="short_description hiddenSpan"><p>Returns <code>true</code> if the selection is empty.</p>
@ -532,7 +530,7 @@
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.isMultiLine" class="ellipsis_description"><p>Returns <code>true</code> if the selection is a multi-line. ...</p>
<div id="ellipsis_Selection.isMultiLine" class="ellipsis_description"><p>Returns <code>true</code> if the selection is a multi-line.</p>
</div>
<div id="short_Selection.isMultiLine" class="short_description hiddenSpan"><p>Returns <code>true</code> if the selection is a multi-line.</p>
@ -560,7 +558,7 @@
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.mergeOverlappingRanges" class="ellipsis_description"><p>Merges overlapping ranges ensuring consistency after changes ...</p>
<div id="ellipsis_Selection.mergeOverlappingRanges" class="ellipsis_description"><p>Merges overlapping ranges ensuring consistency after changes</p>
</div>
<div id="short_Selection.mergeOverlappingRanges" class="short_description hiddenSpan"><p>Merges overlapping ranges ensuring consistency after changes</p>
@ -589,7 +587,7 @@
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.moveCursorBy" class="ellipsis_description"><p>Moves the cursor to position indicated by the parameters. Negative numbers move the cursor backwards in the document. ...</p>
<div id="ellipsis_Selection.moveCursorBy" class="ellipsis_description"><p>Moves the cursor to position indicated by the parameters. Negative numbers move the cursor backwards in the document.</p>
</div>
<div id="short_Selection.moveCursorBy" class="short_description hiddenSpan"><p>Moves the cursor to position indicated by the parameters. Negative numbers move the cursor backwards in the document.</p>
@ -618,7 +616,7 @@
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.moveCursorDown" class="ellipsis_description"><p>Moves the cursor down one row. ...</p>
<div id="ellipsis_Selection.moveCursorDown" class="ellipsis_description"><p>Moves the cursor down one row.</p>
</div>
<div id="short_Selection.moveCursorDown" class="short_description hiddenSpan"><p>Moves the cursor down one row.</p>
@ -646,7 +644,7 @@
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.moveCursorFileEnd" class="ellipsis_description"><p>Moves the cursor to the end of the file. ...</p>
<div id="ellipsis_Selection.moveCursorFileEnd" class="ellipsis_description"><p>Moves the cursor to the end of the file.</p>
</div>
<div id="short_Selection.moveCursorFileEnd" class="short_description hiddenSpan"><p>Moves the cursor to the end of the file.</p>
@ -674,7 +672,7 @@
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.moveCursorFileStart" class="ellipsis_description"><p>Moves the cursor to the start of the file. ...</p>
<div id="ellipsis_Selection.moveCursorFileStart" class="ellipsis_description"><p>Moves the cursor to the start of the file.</p>
</div>
<div id="short_Selection.moveCursorFileStart" class="short_description hiddenSpan"><p>Moves the cursor to the start of the file.</p>
@ -702,7 +700,7 @@
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.moveCursorLeft" class="ellipsis_description"><p>Moves the cursor left one column. ...</p>
<div id="ellipsis_Selection.moveCursorLeft" class="ellipsis_description"><p>Moves the cursor left one column.</p>
</div>
<div id="short_Selection.moveCursorLeft" class="short_description hiddenSpan"><p>Moves the cursor left one column.</p>
@ -730,7 +728,7 @@
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.moveCursorLineEnd" class="ellipsis_description"><p>Moves the cursor to the end of the line. ...</p>
<div id="ellipsis_Selection.moveCursorLineEnd" class="ellipsis_description"><p>Moves the cursor to the end of the line.</p>
</div>
<div id="short_Selection.moveCursorLineEnd" class="short_description hiddenSpan"><p>Moves the cursor to the end of the line.</p>
@ -758,7 +756,7 @@
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.moveCursorLineStart" class="ellipsis_description"><p>Moves the cursor to the start of the line. ...</p>
<div id="ellipsis_Selection.moveCursorLineStart" class="ellipsis_description"><p>Moves the cursor to the start of the line.</p>
</div>
<div id="short_Selection.moveCursorLineStart" class="short_description hiddenSpan"><p>Moves the cursor to the start of the line.</p>
@ -786,7 +784,7 @@
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.moveCursorLongWordLeft" class="ellipsis_description"><p>Moves the cursor to the word on the left. ...</p>
<div id="ellipsis_Selection.moveCursorLongWordLeft" class="ellipsis_description"><p>Moves the cursor to the word on the left.</p>
</div>
<div id="short_Selection.moveCursorLongWordLeft" class="short_description hiddenSpan"><p>Moves the cursor to the word on the left.</p>
@ -814,7 +812,7 @@
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.moveCursorLongWordRight" class="ellipsis_description"><p>Moves the cursor to the word on the right. ...</p>
<div id="ellipsis_Selection.moveCursorLongWordRight" class="ellipsis_description"><p>Moves the cursor to the word on the right.</p>
</div>
<div id="short_Selection.moveCursorLongWordRight" class="short_description hiddenSpan"><p>Moves the cursor to the word on the right.</p>
@ -842,7 +840,7 @@
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.moveCursorRight" class="ellipsis_description"><p>Moves the cursor right one column. ...</p>
<div id="ellipsis_Selection.moveCursorRight" class="ellipsis_description"><p>Moves the cursor right one column.</p>
</div>
<div id="short_Selection.moveCursorRight" class="short_description hiddenSpan"><p>Moves the cursor right one column.</p>
@ -870,15 +868,15 @@
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.moveCursorTo" class="ellipsis_description"><p>Moves the cursor to the row and column provided. [If <code>preventUpdateDesiredColumn</code> is <code>true</code>, then the cursor stays i...</p>
<div id="ellipsis_Selection.moveCursorTo" class="ellipsis_description"><p>Moves the cursor to the row and column provided. [If <code>preventUpdateDesiredColumn</code> is <code>true</code>, then the cursor stays in the same column position as its original point.]{: #preventUpdateBoolDesc}</p>
</div>
<div id="short_Selection.moveCursorTo" class="short_description hiddenSpan"><p>If <code>preventUpdateDesiredColumn</code> is <code>true</code>, then the cursor stays in the same column position as its original point.</p>
<div id="short_Selection.moveCursorTo" class="short_description hiddenSpan"><p>Moves the cursor to the row and column provided. [If <code>preventUpdateDesiredColumn</code> is <code>true</code>, then the cursor stays in the same column position as its original point.]{: #preventUpdateBoolDesc}</p>
</div>
<h3 id="Selection.moveCursorTo" class="methodToggle methodClicker inactive">&nbsp;&nbsp;&nbsp;</h3>
<div class="description">
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">row</td><td class="argType" "><a href="http://www.nodemanual.org/latest/js_doc/Number.html" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription ">Required. The row to move to</td></tr><tr class="argumentRow "><td class="argName ">column</td><td class="argType" "><a href="http://www.nodemanual.org/latest/js_doc/Number.html" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription ">Required. The column to move to</td></tr><tr class="argumentRow "><td class="argName ">keepDesiredColumn</td><td class="argType" "><a href="http://www.nodemanual.org/latest/js_doc/Boolean.html" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription ">Required. If <code>true</code>, the cursor move does not respect the previous column</td></tr></table>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">row</td><td class="argType" "><a href="http://www.nodemanual.org/latest/js_doc/Number.html" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription ">Required. The row to move to</td></tr><tr class="argumentRow "><td class="argName ">column</td><td class="argType" "><a href="http://www.nodemanual.org/latest/js_doc/Number.html" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription ">Required. The column to move to</td></tr><tr class="argumentRow "><td class="argName ">keepDesiredColumn</td><td class="argType" "><a href="http://www.nodemanual.org/latest/js_doc/Boolean.html" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription ">Required. [If <code>true</code>, the cursor move does not respect the previous column]{: #preventUpdateBool}</td></tr></table>
</div>
</div>
</div>
@ -899,7 +897,7 @@
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.moveCursorToPosition" class="ellipsis_description"><p>Moves the selection to the position indicated by its <code>row</code> and <code>column</code>. ...</p>
<div id="ellipsis_Selection.moveCursorToPosition" class="ellipsis_description"><p>Moves the selection to the position indicated by its <code>row</code> and <code>column</code>.</p>
</div>
<div id="short_Selection.moveCursorToPosition" class="short_description hiddenSpan"><p>Moves the selection to the position indicated by its <code>row</code> and <code>column</code>.</p>
@ -928,15 +926,15 @@
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.moveCursorToScreen" class="ellipsis_description"><p>Moves the cursor to the screen position indicated by row and column. If <code>preventUpdateDesiredColumn</code> is <code>true</code>, then the cursor stays in the same column position as its original point. ...</p>
<div id="ellipsis_Selection.moveCursorToScreen" class="ellipsis_description"><p>Moves the cursor to the screen position indicated by row and column. {:preventUpdateBoolDesc}</p>
</div>
<div id="short_Selection.moveCursorToScreen" class="short_description hiddenSpan"><p>Moves the cursor to the screen position indicated by row and column. If <code>preventUpdateDesiredColumn</code> is <code>true</code>, then the cursor stays in the same column position as its original point.</p>
<div id="short_Selection.moveCursorToScreen" class="short_description hiddenSpan"><p>Moves the cursor to the screen position indicated by row and column. {:preventUpdateBoolDesc}</p>
</div>
<h3 id="Selection.moveCursorToScreen" class="methodToggle methodClicker inactive">&nbsp;&nbsp;&nbsp;</h3>
<div class="description">
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">row</td><td class="argType" "><a href="http://www.nodemanual.org/latest/js_doc/Number.html" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription ">Required. The row to move to</td></tr><tr class="argumentRow "><td class="argName ">column</td><td class="argType" "><a href="http://www.nodemanual.org/latest/js_doc/Number.html" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription ">Required. The column to move to</td></tr><tr class="argumentRow "><td class="argName ">keepDesiredColumn</td><td class="argType" "><a href="http://www.nodemanual.org/latest/js_doc/Boolean.html" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription ">Required. If <code>true</code>, the cursor move does not respect the previous column</td></tr></table>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">row</td><td class="argType" "><a href="http://www.nodemanual.org/latest/js_doc/Number.html" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription ">Required. The row to move to</td></tr><tr class="argumentRow "><td class="argName ">column</td><td class="argType" "><a href="http://www.nodemanual.org/latest/js_doc/Number.html" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription ">Required. The column to move to</td></tr><tr class="argumentRow "><td class="argName ">keepDesiredColumn</td><td class="argType" "><a href="http://www.nodemanual.org/latest/js_doc/Boolean.html" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription ">Required. {:preventUpdateBool}</td></tr></table>
</div>
</div>
</div>
@ -957,7 +955,7 @@
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.moveCursorUp" class="ellipsis_description"><p>Moves the cursor up one row. ...</p>
<div id="ellipsis_Selection.moveCursorUp" class="ellipsis_description"><p>Moves the cursor up one row.</p>
</div>
<div id="short_Selection.moveCursorUp" class="short_description hiddenSpan"><p>Moves the cursor up one row.</p>
@ -990,92 +988,154 @@
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.rectangularRangeBlock" class="ellipsis_description"><p>Gets list of ranges composing rectangular block on the screen
...</p>
<div id="ellipsis_Selection.rectangularRangeBlock" class="ellipsis_description"><p>Gets list of ranges composing rectangular block on the screen</p>
</div>
<div id="short_Selection.rectangularRangeBlock" class="short_description hiddenSpan"><p>Gets list of ranges composing rectangular block on the screen
</p>
<div id="short_Selection.rectangularRangeBlock" class="short_description hiddenSpan"><p>Gets list of ranges composing rectangular block on the screen</p>
<p>/
this.rectangularRangeBlock = function(screenCursor, screenAnchor, includeEmptyLines) {</p>
<pre><code> var rectSel = []<span class="comment">;</span>
var xBackwards = screenCursor<span class="preprocessor">.column</span> &lt; screenAnchor<span class="preprocessor">.column</span><span class="comment">;</span>
if (xBackwards) {
var startColumn = screenCursor<span class="preprocessor">.column</span><span class="comment">;</span>
var endColumn = screenAnchor<span class="preprocessor">.column</span><span class="comment">;</span>
} else {
var startColumn = screenAnchor<span class="preprocessor">.column</span><span class="comment">;</span>
var endColumn = screenCursor<span class="preprocessor">.column</span><span class="comment">;</span>
}
var yBackwards = screenCursor<span class="preprocessor">.row</span> &lt; screenAnchor<span class="preprocessor">.row</span><span class="comment">;</span>
if (yBackwards) {
var startRow = screenCursor<span class="preprocessor">.row</span><span class="comment">;</span>
var endRow = screenAnchor<span class="preprocessor">.row</span><span class="comment">;</span>
} else {
var startRow = screenAnchor<span class="preprocessor">.row</span><span class="comment">;</span>
var endRow = screenCursor<span class="preprocessor">.row</span><span class="comment">;</span>
}
if (startColumn &lt; <span class="number">0</span>)
startColumn = <span class="number">0</span><span class="comment">;</span>
if (startRow &lt; <span class="number">0</span>)
startRow = <span class="number">0</span><span class="comment">;</span>
if (startRow == endRow)
includeEmptyLines = true<span class="comment">;</span>
for (var row = startRow<span class="comment">; row &lt;= endRow; row++) {</span>
var range = Range<span class="preprocessor">.fromPoints</span>(
this<span class="preprocessor">.session</span><span class="preprocessor">.screenToDocumentPosition</span>(row, startColumn),
this<span class="preprocessor">.session</span><span class="preprocessor">.screenToDocumentPosition</span>(row, endColumn)
)<span class="comment">;</span>
if (range<span class="preprocessor">.isEmpty</span>()) {
if (docEnd &amp;&amp; isSamePoint(range<span class="preprocessor">.end</span>, docEnd))
<span class="keyword">break</span><span class="comment">;</span>
var docEnd = range<span class="preprocessor">.end</span><span class="comment">;</span>
}
range<span class="preprocessor">.cursor</span> = xBackwards ? range<span class="preprocessor">.start</span> : range<span class="preprocessor">.end</span><span class="comment">;</span>
rectSel<span class="preprocessor">.push</span>(range)<span class="comment">;</span>
}
if (yBackwards)
rectSel<span class="preprocessor">.reverse</span>()<span class="comment">;</span>
if (!includeEmptyLines) {
var end = rectSel<span class="preprocessor">.length</span> - <span class="number">1</span><span class="comment">;</span>
while (rectSel[end]<span class="preprocessor">.isEmpty</span>() &amp;&amp; end > <span class="number">0</span>)
end--<span class="comment">;</span>
if (end > <span class="number">0</span>) {
var start = <span class="number">0</span><span class="comment">;</span>
while (rectSel[start]<span class="preprocessor">.isEmpty</span>())
start++<span class="comment">;</span>
}
for (var i = end<span class="comment">; i >= start; i--) {</span>
if (rectSel[i]<span class="preprocessor">.isEmpty</span>())
rectSel<span class="preprocessor">.splice</span>(i, <span class="number">1</span>)<span class="comment">;</span>
}
}
return rectSel<span class="comment">;</span></code></pre>
<p> };
}).call(Selection.prototype);</p>
<p>// extend Editor
var Editor = require(&quot;./editor&quot;).Editor;
(function() {</p>
<p> /** extension
Editor.updateSelectionMarkers()</p>
<p>Updates the cursor and marker layers.</p>
</div>
<h3 id="Selection.rectangularRangeBlock" class="methodToggle methodClicker inactive">&nbsp;&nbsp;&nbsp;</h3>
<div class="description"><p>/
this.rectangularRangeBlock = function(screenCursor, screenAnchor, includeEmptyLines) {
var rectSel = [];
this.rectangularRangeBlock = function(screenCursor, screenAnchor, includeEmptyLines) {</p>
<pre><code> var rectSel = []<span class="comment">;</span>
</p>
<pre><code> var xBackwards = screenCursor.column &lt; screenAnchor.column;
var xBackwards = screenCursor<span class="preprocessor">.column</span> &lt; screenAnchor<span class="preprocessor">.column</span><span class="comment">;</span>
if (xBackwards) {
var startColumn = screenCursor.column;
var endColumn = screenAnchor.column;
var startColumn = screenCursor<span class="preprocessor">.column</span><span class="comment">;</span>
var endColumn = screenAnchor<span class="preprocessor">.column</span><span class="comment">;</span>
} else {
var startColumn = screenAnchor.column;
var endColumn = screenCursor.column;
var startColumn = screenAnchor<span class="preprocessor">.column</span><span class="comment">;</span>
var endColumn = screenCursor<span class="preprocessor">.column</span><span class="comment">;</span>
}
var yBackwards = screenCursor.row &lt; screenAnchor.row;
var yBackwards = screenCursor<span class="preprocessor">.row</span> &lt; screenAnchor<span class="preprocessor">.row</span><span class="comment">;</span>
if (yBackwards) {
var startRow = screenCursor.row;
var endRow = screenAnchor.row;
var startRow = screenCursor<span class="preprocessor">.row</span><span class="comment">;</span>
var endRow = screenAnchor<span class="preprocessor">.row</span><span class="comment">;</span>
} else {
var startRow = screenAnchor.row;
var endRow = screenCursor.row;
var startRow = screenAnchor<span class="preprocessor">.row</span><span class="comment">;</span>
var endRow = screenCursor<span class="preprocessor">.row</span><span class="comment">;</span>
}
if (startColumn &lt; 0)
startColumn = 0;
if (startRow &lt; 0)
startRow = 0;
if (startColumn &lt; <span class="number">0</span>)
startColumn = <span class="number">0</span><span class="comment">;</span>
if (startRow &lt; <span class="number">0</span>)
startRow = <span class="number">0</span><span class="comment">;</span>
if (startRow == endRow)
includeEmptyLines = true;
includeEmptyLines = true<span class="comment">;</span>
for (var row = startRow; row &lt;= endRow; row++) {
var range = Range.fromPoints(
this.session.screenToDocumentPosition(row, startColumn),
this.session.screenToDocumentPosition(row, endColumn)
);
if (range.isEmpty()) {
if (docEnd &amp;&amp; isSamePoint(range.end, docEnd))
break;
var docEnd = range.end;
for (var row = startRow<span class="comment">; row &lt;= endRow; row++) {</span>
var range = Range<span class="preprocessor">.fromPoints</span>(
this<span class="preprocessor">.session</span><span class="preprocessor">.screenToDocumentPosition</span>(row, startColumn),
this<span class="preprocessor">.session</span><span class="preprocessor">.screenToDocumentPosition</span>(row, endColumn)
)<span class="comment">;</span>
if (range<span class="preprocessor">.isEmpty</span>()) {
if (docEnd &amp;&amp; isSamePoint(range<span class="preprocessor">.end</span>, docEnd))
<span class="keyword">break</span><span class="comment">;</span>
var docEnd = range<span class="preprocessor">.end</span><span class="comment">;</span>
}
range.cursor = xBackwards ? range.start : range.end;
rectSel.push(range);
range<span class="preprocessor">.cursor</span> = xBackwards ? range<span class="preprocessor">.start</span> : range<span class="preprocessor">.end</span><span class="comment">;</span>
rectSel<span class="preprocessor">.push</span>(range)<span class="comment">;</span>
}
if (yBackwards)
rectSel.reverse();
rectSel<span class="preprocessor">.reverse</span>()<span class="comment">;</span>
if (!includeEmptyLines) {
var end = rectSel.length - 1;
while (rectSel[end].isEmpty() &amp;&amp; end &gt; 0)
end--;
if (end &gt; 0) {
var start = 0;
while (rectSel[start].isEmpty())
start++;
var end = rectSel<span class="preprocessor">.length</span> - <span class="number">1</span><span class="comment">;</span>
while (rectSel[end]<span class="preprocessor">.isEmpty</span>() &amp;&amp; end > <span class="number">0</span>)
end--<span class="comment">;</span>
if (end > <span class="number">0</span>) {
var start = <span class="number">0</span><span class="comment">;</span>
while (rectSel[start]<span class="preprocessor">.isEmpty</span>())
start++<span class="comment">;</span>
}
for (var i = end; i &gt;= start; i--) {
if (rectSel[i].isEmpty())
rectSel.splice(i, 1);
for (var i = end<span class="comment">; i >= start; i--) {</span>
if (rectSel[i]<span class="preprocessor">.isEmpty</span>())
rectSel<span class="preprocessor">.splice</span>(i, <span class="number">1</span>)<span class="comment">;</span>
}
}
return rectSel;</code></pre>
return rectSel<span class="comment">;</span></code></pre>
<p> };
}).call(Selection.prototype);
</p>
}).call(Selection.prototype);</p>
<p>// extend Editor
var Editor = require(&quot;./editor&quot;).Editor;
(function() {
</p>
(function() {</p>
<p> /** extension
Editor.updateSelectionMarkers()
</p>
Editor.updateSelectionMarkers()</p>
<p>Updates the cursor and marker layers.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">screenCursor</td><td class="argType" "><a href="https://github.com/ajaxorg/ace/blob/master/lib/ace/layer/cursor.js" class="" title="Cursor" data-id="Cursor">Cursor</a></td><td class="argDescription ">Required. The cursor to use</td></tr><tr class="argumentRow "><td class="argName ">screenAnchor</td><td class="argType" "><a href="anchor.html#Anchor" class="" title="Anchor (class)" data-id="Anchor">Anchor</a></td><td class="argDescription ">Required. The anchor to use</td></tr><tr class="argumentRow "><td class="argName ">includeEmptyLins</td><td class="argType" "><a href="http://www.nodemanual.org/latest/js_doc/Boolean.html" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription ">Required. If true, this includes ranges inside the block which are empty due to clipping</td></tr></table>
@ -1104,7 +1164,7 @@ Editor.updateSelectionMarkers()
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.substractPoint" class="ellipsis_description"><p>Removes a Range containing pos (if it exists). ...</p>
<div id="ellipsis_Selection.substractPoint" class="ellipsis_description"><p>Removes a Range containing pos (if it exists).</p>
</div>
<div id="short_Selection.substractPoint" class="short_description hiddenSpan"><p>Removes a Range containing pos (if it exists).</p>
@ -1133,7 +1193,7 @@ Editor.updateSelectionMarkers()
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.selectAll" class="ellipsis_description"><p>Selects all the text in the document. ...</p>
<div id="ellipsis_Selection.selectAll" class="ellipsis_description"><p>Selects all the text in the document.</p>
</div>
<div id="short_Selection.selectAll" class="short_description hiddenSpan"><p>Selects all the text in the document.</p>
@ -1162,7 +1222,7 @@ Editor.updateSelectionMarkers()
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.selectAWord" class="ellipsis_description"><p>Selects a word, including its right whitespace. ...</p>
<div id="ellipsis_Selection.selectAWord" class="ellipsis_description"><p>Selects a word, including its right whitespace.</p>
</div>
<div id="short_Selection.selectAWord" class="short_description hiddenSpan"><p>Selects a word, including its right whitespace.</p>
@ -1190,7 +1250,7 @@ Editor.updateSelectionMarkers()
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.selectDown" class="ellipsis_description"><p>Moves the selection down one row. ...</p>
<div id="ellipsis_Selection.selectDown" class="ellipsis_description"><p>Moves the selection down one row.</p>
</div>
<div id="short_Selection.selectDown" class="short_description hiddenSpan"><p>Moves the selection down one row.</p>
@ -1218,7 +1278,7 @@ Editor.updateSelectionMarkers()
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.selectFileEnd" class="ellipsis_description"><p>Moves the selection to the end of the file. ...</p>
<div id="ellipsis_Selection.selectFileEnd" class="ellipsis_description"><p>Moves the selection to the end of the file.</p>
</div>
<div id="short_Selection.selectFileEnd" class="short_description hiddenSpan"><p>Moves the selection to the end of the file.</p>
@ -1246,7 +1306,7 @@ Editor.updateSelectionMarkers()
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.selectFileStart" class="ellipsis_description"><p>Moves the selection to the start of the file. ...</p>
<div id="ellipsis_Selection.selectFileStart" class="ellipsis_description"><p>Moves the selection to the start of the file.</p>
</div>
<div id="short_Selection.selectFileStart" class="short_description hiddenSpan"><p>Moves the selection to the start of the file.</p>
@ -1274,7 +1334,7 @@ Editor.updateSelectionMarkers()
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.selectLeft" class="ellipsis_description"><p>Moves the selection left one column. ...</p>
<div id="ellipsis_Selection.selectLeft" class="ellipsis_description"><p>Moves the selection left one column.</p>
</div>
<div id="short_Selection.selectLeft" class="short_description hiddenSpan"><p>Moves the selection left one column.</p>
@ -1302,7 +1362,7 @@ Editor.updateSelectionMarkers()
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.selectLine" class="ellipsis_description"><p>Selects the entire line. ...</p>
<div id="ellipsis_Selection.selectLine" class="ellipsis_description"><p>Selects the entire line.</p>
</div>
<div id="short_Selection.selectLine" class="short_description hiddenSpan"><p>Selects the entire line.</p>
@ -1330,7 +1390,7 @@ Editor.updateSelectionMarkers()
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.selectLineEnd" class="ellipsis_description"><p>Moves the selection to the end of the current line. ...</p>
<div id="ellipsis_Selection.selectLineEnd" class="ellipsis_description"><p>Moves the selection to the end of the current line.</p>
</div>
<div id="short_Selection.selectLineEnd" class="short_description hiddenSpan"><p>Moves the selection to the end of the current line.</p>
@ -1358,7 +1418,7 @@ Editor.updateSelectionMarkers()
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.selectLineStart" class="ellipsis_description"><p>Moves the selection to the beginning of the current line. ...</p>
<div id="ellipsis_Selection.selectLineStart" class="ellipsis_description"><p>Moves the selection to the beginning of the current line.</p>
</div>
<div id="short_Selection.selectLineStart" class="short_description hiddenSpan"><p>Moves the selection to the beginning of the current line.</p>
@ -1386,7 +1446,7 @@ Editor.updateSelectionMarkers()
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.selectRight" class="ellipsis_description"><p>Moves the selection right one column. ...</p>
<div id="ellipsis_Selection.selectRight" class="ellipsis_description"><p>Moves the selection right one column.</p>
</div>
<div id="short_Selection.selectRight" class="short_description hiddenSpan"><p>Moves the selection right one column.</p>
@ -1414,7 +1474,7 @@ Editor.updateSelectionMarkers()
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.selectTo" class="ellipsis_description"><p>Moves the selection cursor to the indicated row and column. ...</p>
<div id="ellipsis_Selection.selectTo" class="ellipsis_description"><p>Moves the selection cursor to the indicated row and column.</p>
</div>
<div id="short_Selection.selectTo" class="short_description hiddenSpan"><p>Moves the selection cursor to the indicated row and column.</p>
@ -1443,7 +1503,7 @@ Editor.updateSelectionMarkers()
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.selectToPosition" class="ellipsis_description"><p>Moves the selection cursor to the row and column indicated by <code>pos</code>. ...</p>
<div id="ellipsis_Selection.selectToPosition" class="ellipsis_description"><p>Moves the selection cursor to the row and column indicated by <code>pos</code>.</p>
</div>
<div id="short_Selection.selectToPosition" class="short_description hiddenSpan"><p>Moves the selection cursor to the row and column indicated by <code>pos</code>.</p>
@ -1472,7 +1532,7 @@ Editor.updateSelectionMarkers()
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.selectUp" class="ellipsis_description"><p>Moves the selection up one row. ...</p>
<div id="ellipsis_Selection.selectUp" class="ellipsis_description"><p>Moves the selection up one row.</p>
</div>
<div id="short_Selection.selectUp" class="short_description hiddenSpan"><p>Moves the selection up one row.</p>
@ -1501,7 +1561,7 @@ Editor.updateSelectionMarkers()
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.selectWord" class="ellipsis_description"><p>Moves the selection to highlight the entire word. ...</p>
<div id="ellipsis_Selection.selectWord" class="ellipsis_description"><p>Moves the selection to highlight the entire word.</p>
</div>
<div id="short_Selection.selectWord" class="short_description hiddenSpan"><p>Moves the selection to highlight the entire word.</p>
@ -1529,7 +1589,7 @@ Editor.updateSelectionMarkers()
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.selectWordLeft" class="ellipsis_description"><p>Moves the selection to the first word on the left. ...</p>
<div id="ellipsis_Selection.selectWordLeft" class="ellipsis_description"><p>Moves the selection to the first word on the left.</p>
</div>
<div id="short_Selection.selectWordLeft" class="short_description hiddenSpan"><p>Moves the selection to the first word on the left.</p>
@ -1557,7 +1617,7 @@ Editor.updateSelectionMarkers()
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.selectWordRight" class="ellipsis_description"><p>Moves the selection to the first word on the right. ...</p>
<div id="ellipsis_Selection.selectWordRight" class="ellipsis_description"><p>Moves the selection to the first word on the right.</p>
</div>
<div id="short_Selection.selectWordRight" class="short_description hiddenSpan"><p>Moves the selection to the first word on the right.</p>
@ -1585,7 +1645,7 @@ Editor.updateSelectionMarkers()
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.setSelectionAnchor" class="ellipsis_description"><p>Sets the row and column position of the anchor. This function also emits the <code>&#39;changeSelection&#39;</code> event. ...</p>
<div id="ellipsis_Selection.setSelectionAnchor" class="ellipsis_description"><p>Sets the row and column position of the anchor. This function also emits the <code>&#39;changeSelection&#39;</code> event.</p>
</div>
<div id="short_Selection.setSelectionAnchor" class="short_description hiddenSpan"><p>Sets the row and column position of the anchor. This function also emits the <code>&#39;changeSelection&#39;</code> event.</p>
@ -1614,7 +1674,7 @@ Editor.updateSelectionMarkers()
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.setSelectionRange" class="ellipsis_description"><p>Sets the selection to the provided range. ...</p>
<div id="ellipsis_Selection.setSelectionRange" class="ellipsis_description"><p>Sets the selection to the provided range.</p>
</div>
<div id="short_Selection.setSelectionRange" class="short_description hiddenSpan"><p>Sets the selection to the provided range.</p>
@ -1643,7 +1703,7 @@ Editor.updateSelectionMarkers()
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Selection.shiftSelection" class="ellipsis_description"><p>Shifts the selection up (or down, if <a href="#Selection.isBackwards" class="link-short" title="Selection.isBackwards (class method)" data-id="Selection.isBackwards">isBackwards</a> is true) the given number of columns. ...</p>
<div id="ellipsis_Selection.shiftSelection" class="ellipsis_description"><p>Shifts the selection up (or down, if <a href="#Selection.isBackwards" class="link-short" title="Selection.isBackwards (class method)" data-id="Selection.isBackwards">isBackwards</a> is true) the given number of columns.</p>
</div>
<div id="short_Selection.shiftSelection" class="short_description hiddenSpan"><p>Shifts the selection up (or down, if <a href="#Selection.isBackwards" class="link-short" title="Selection.isBackwards (class method)" data-id="Selection.isBackwards">isBackwards</a> is true) the given number of columns.</p>