Stores all the data about [[Editor Editor
]] state providing easy way to change editors state.
EditSession
can be attached to only one [[Document Document
]]. Same Document
can be attached to several EditSession
s.
If text
contains either the newline (\n
) or carriage-return ('\r') characters, $autoNewLine
stores that value.
A block of text
any
Given a string, returns an array of the display characters, including tabs and spaces.
The string to check
The value to start at
any
Calculates the width of the string str
on the screen while assuming that the string starts at the first column on the screen.
The string to calculate the screen width of
Array<number>
Sets a new text mode for the EditSession
. This method also emits the 'changeMode'
event. If a [[BackgroundTokenizer BackgroundTokenizer
]] is set, the 'tokenizerUpdate'
event is also emitted.
Set a new text mode
any
undefined
The row to work with
any
Adds a dynamic marker to the session.
object with update method
Set to true
to establish a front marker
any
any
Adds className
to the row
, to be used for CSS stylings and whatnot.
The row number
The class to add
any
Adds a new marker to the given Range
. If inFront
is true
, a front marker is defined, and the 'changeFrontMarker'
event fires; otherwise, the 'changeBackMarker'
event fires.
Define the range of the marker
Set the CSS class for the marker
Identify the type of the marker
Set to true
to establish a front marker
any
Adds a new marker to the given Range
. If inFront
is true
, a front marker is defined, and the 'changeFrontMarker'
event fires; otherwise, the 'changeBackMarker'
event fires.
Define the range of the marker
Set the CSS class for the marker
Identify the type of the marker
Set to true
to establish a front marker
any
This should generally only be called by the renderer when a resize is detected.
The new wrap limit
boolean
Clears all the annotations for this session. This function also triggers the 'changeAnnotation'
event.
any
Removes a breakpoint on the row number given by rows
. This function also emites the 'changeBreakpoint'
event.
A row index
any
Removes all breakpoints on the rows. This function also emites the 'changeBreakpoint'
event.
any
For the given document row and column, returns the screen column.
number
Converts document coordinates to screen coordinates. {:conversionConsiderations}
The document row to check
The document column to check
any
For the given document row and column, returns the screen row.
any
Duplicates all the text between firstRow
and lastRow
.
The starting row to duplicate
The final row to duplicate
number
any
any
Gets the range of a word, including its right whitespace.
The row number to start from
The column number to start from
any
Returns the annotations for the EditSession
.
any
Returns an array of numbers, indicating which rows have breakpoints.
Array<number>
Returns the Document
associated with this session.
For the given document row and column, this returns the column position of the last screen row.
number
For the given document row and column, this returns the document position of the last row.
number
any
any
any
Returns the number of rows in the document.
number
Returns a verbatim copy of the given line as it is in the document
The row to retrieve from
string
Returns an array of strings of the rows between firstRow
and lastRow
. This function is inclusive of lastRow
.
The first row index to retrieve
The final row index to retrieve
Array<string>
Returns an array containing the IDs of all the markers, either front or back.
If true
, indicates you only want front markers; false
indicates only back markers
Array<any>
Returns the current text mode.
Returns the current new line mode.
string
Returns true
if overwrites are enabled; false
otherwise.
boolean
Returns number of screenrows in a wrapped line.
The row number to check
number
For the given row, this returns the split data.
string
Returns the position (on screen) for the last character in the provided screen row.
The screen row to check
number
Returns the length of the screen.
number
The distance to the next tab stop at the specified screen column.
The screen column to check
number
Returns the width of the screen.
number
[Returns the value of the distance between the left of the editor and the leftmost part of the visible content.]{: #EditSession.getScrollLeft}
number
[Returns the value of the distance between the top of the editor and the topmost part of the visible content.]{: #EditSession.getScrollTop}
number
Returns the string of the current selection.
{:BackgroundTokenizer.getState}
The row to start at
string
Returns the current tab size.
string
Returns the current value for tabs. If the user is using soft tabs, this will be a series of spaces (defined by [[EditSession.getTabSize getTabSize()
]]); otherwise it's simply '\t'
.
string
{:Document.getTextRange.desc}
The range to work with
string
Returns an object indicating the token at the current row. The object has two properties: index
and start
.
The row number to retrieve from
The column number to retrieve from
Starts tokenizing at the row indicated. Returns a list of objects of the tokenized rows.
The row to start at
Returns the current undo manager.
Returns true
if soft tabs are being used, false
otherwise.
boolean
Returns true
if workers are being used.
boolean
Returns true
if wrap mode is being used; false
otherwise.
boolean
Returns the current [[Document Document
]] as a string.
string
Given a starting row and column, this method returns the Range
of the first word boundary it finds.
The row to start at
The column to start at
Returns the value of wrap limit.
number
Returns an object that defines the minimum and maximum of the wrap limit; it looks something like this: { min: wrapLimitRange_min, max: wrapLimitRange_max }
any
any
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 [[EditSession.getTabString getTabString()
]].
Starting row
Ending row
The indent token
any
Inserts a block of text
and the indicated position
.
The position {row, column} to start inserting at
A chunk of text to insert
any
Returns true
if the character at the position is a soft tab.
The position to check
boolean
Shifts all the lines in the document down one, starting from firstRow
and ending at lastRow
.
The starting row to move down
The final row to move down
number
Shifts all the lines in the document up one, starting from firstRow
and ending at lastRow
.
The starting row to move up
The final row to move up
number
Moves a range of text from the given range to the given position. toPosition
is an object that looks like this:
{ row: newRowLocation, column: newColumnLocation }
The range of text you want moved within the document
The location (row and column) where you want to move the text to
any
Reloads all the tokens on the current session. This function calls [[BackgroundTokenizer.start BackgroundTokenizer.start ()
]] to all the rows; it also emits the 'tokenizerUpdate'
event.
any
Outdents all the rows defined by the start
and end
properties of range
.
A range of rows
any
Re-implements a previously undone change to your document.
An array of previous changes
Removes the range
from the document.
A specified Range to remove
any
any
Removes className
from the row
.
The row number
The class to add
any
Removes the marker with the specified ID. If this marker was in front, the 'changeFrontMarker'
event is emitted. If the marker was in the back, the 'changeBackMarker'
event is emitted.
A number representing a marker
any
Replaces a range in the document with the new text
.
A specified Range to replace
The new text to use as a replacement
any
any
Converts characters coordinates on the screen to characters coordinates within the document. [This takes into account code folding, word wrap, tab size, and any other visual modifications.]{: #conversionConsiderations}
The screen row to check
The screen column to check
any
Sets annotations for the EditSession
. This functions emits the 'changeAnnotation'
event.
A list of annotations
any
Sets a breakpoint on the row number given by rows
. This function also emites the 'changeBreakpoint'
event.
A row index
Class of the breakpoint
any
Sets a breakpoint on every row number given by rows
. This function also emites the 'changeBreakpoint'
event.
An array of row indices
any
Sets the EditSession
to point to a new Document
. If a BackgroundTokenizer
exists, it also points to doc
.
The new Document
to use
any
any
{:Document.setNewLineMode.desc}
any
Pass in true
to enable overwrites in your session, or false
to disable.
If overwrites is enabled, any text you enter will type over any text after it. If the value of overwrite
changes, this function also emites the changeOverwrite
event.
Defines wheter or not to set overwrites
any
[Sets the value of the distance between the left of the editor and the leftmost part of the visible content.]{: #EditSession.setScrollLeft}
any
This function sets the scroll top value. It also emits the 'changeScrollTop'
event.
The new scroll top value
any
Set the number of spaces that define a soft tab; for example, passing in 4
transforms the soft tabs to be equivalent to four spaces. This function also emits the changeTabSize
event.
The new tab size
any
Sets the undo manager.
The new undo manager
any
Enables or disables highlighting of the range where an undo occured.
If true
, selects the range of the reinserted change
any
Pass true
to enable the use of soft tabs. Soft tabs means you're using spaces instead of the tab character ('\t'
).
Value indicating whether or not to use soft tabs
any
Identifies if you want to use a worker for the EditSession
.
Set to true
to use a worker
any
Sets whether or not line wrapping is enabled. If useWrapMode
is different than the current value, the 'changeWrapMode'
event is emitted.
Enable (or disable) wrap mode
any
Sets the session text.
The new text to place
any
Sets the boundaries of wrap. Either value can be null
to have an unconstrained wrap, or, they can be the same number to pin the limit. If the wrap limits for min
or max
are different, this method also emits the 'changeWrapMode'
event.
The minimum wrap value (the left side wrap)
The maximum wrap value (the right side wrap)
any
Sets the value of overwrite to the opposite of whatever it currently is.
any
Reverts previous changes to your document.
An array of previous changes
{: #dontSelect}
any