Stores various states related to a Document. A single EditSession can be in charge of several Documents.
EditSession[edit]
Constructors
Sets up a new EditSession and associates it with the given Document and TextMode. ...
Events
-
- EditSession.on("onChange", function(e))
Emitted when the document changes. ...
-
- EditSession.on("onChangeFold", function(e))
Emitted when a code fold changes its state. ...
-
- EditSession.on("onReloadTokenizer", function(e))
Reloads all the tokens on the current session. This function calls [[BackgroundTokenizer.start `BackgroundTokenizer....
Methods
Adds a new marker to the given Range. If inFront is true, a front marker is defined, and the `'changeFrontMark...
-
- EditSession.clearAnnotations()
Clears all the annotations for this session. This function also triggers the 'changeAnnotation' event. ...
-
- EditSession.clearBreakpoints()
Removes all breakpoints on the rows. This function also emites the 'changeBreakpoint' event. ...
Converts document coordinates to screen coordinates. This takes into account code folding, word wrap, tab size, and any other visual modifications. ...
-
- EditSession.getAnnotations()
Returns the annotations for the EditSession. ...
-
- EditSession.getBreakpoints()
Returns an array of numbers, indicating which rows have breakpoints. ...
-
- EditSession.getDocument()
Returns the Document associated with this session. ...
-
- EditSession.getLength()
Returns the number of rows in the document. ...
-
- EditSession.getMode()
Returns the current text mode. ...
-
- EditSession.getNewLineMode()
Returns the current new line mode. ...
-
- EditSession.getOverwrite()
Returns true if overwrites are enabled; false otherwise. ...
-
- EditSession.getScreenLength()
Returns the length of the screen. ...
-
- EditSession.getScreenWidth()
Returns the width of the screen. ...
-
- EditSession.getScrollLeft()
[Returns the value of the distance between the left of the editor and the leftmost part of the visible content.]{: #...
-
- EditSession.getScrollTop()
[Returns the value of the distance between the top of the editor and the topmost part of the visible content.]{: #Ed...
-
- EditSession.getSelection()
Returns the string of the current selection. ...
-
- EditSession.getTabSize()
Returns the current tab size. ...
-
- EditSession.getTabString()
Returns the current value for tabs. If the user is using soft tabs, this will be a series of spaces (defined by [[Ed...
-
- EditSession.getUndoManager()
Returns the current undo manager. ...
-
- EditSession.getUseSoftTabs()
Returns true if soft tabs are being used, false otherwise. ...
-
- EditSession.getUseWorker()
Returns true if workers are being used. ...
-
- EditSession.getUseWrapMode()
Returns true if wrap mode is being used; false otherwise. ...
-
- EditSession.getWidth()
Returns the width of the document. ...
-
- EditSession.getWrapLimit()
Returns the value of wrap limit. ...
-
- EditSession.getWrapLimitRange()
Returns an object that defines the minimum and maximum of the wrap limit; it looks something like this: ...
{ min: wrapLimitRange_min, max: wrapLimitRange_max }
Indents all the rows, from startRow to endRow (inclusive), by prefixing each row with the token in indentString.
...
If indentString contains the '\t' character, it's replaced by whatever is defined by getTabString.
Arguments
| startRow | Number | Required. Starting row |
| endRow | Number | Required. Ending row |
| indentString | String | Required. The indent token |
Shifts all the lines in the document up one, starting from firstRow and ending at lastRow. ...
{ row: newRowLocation, column: newColumnLocation } ...
Arguments
| fromRange | Range | Required. The range of text you want moved within the document |
| toPosition | Object | Required. The location (row and column) where you want to move the text to |
Returns
| Range | The new range where the text was moved to. Moves a range of text from the given range to the given position. toPosition is an object that looks like this: |
Replaces a range in the document with the new text. ...
Arguments
| range | Range | Required. A specified Range to replace |
| text | String | Required. The new text to use as a replacement |
Returns
| Object | Returns an object containing the final row and column, like this:{row: endRow, column: 0}If the text and range are empty, this function returns an object containing the current range.start value.If the text is the exact same as what currently exists, this function returns an object containing the current range.end value. |
Converts characters coordinates on the screen to characters coordinates within the document. [This takes into accoun...
-
- EditSession.setScrollLeft(scrollLeft)
[Sets the value of the distance between the left of the editor and the leftmost part of the visible content.]{: #Edi...
-
- EditSession.setUndoManager(UndoManager undoManager)
-
- EditSession.toggleOverwrite()
Sets the value of overwrite to the opposite of whatever it currently is. ...