| SciTE Lua scripting of edit and output panes using Scintilla API

# Scintilla API calls

Both the edit and output panes are Scintilla controls and can be scripted using Scintilla's API.

The API is presented here as it is called from Lua for the edit pane. All of the same features are available for the output pane by substituting 'output' for 'editor'.

In Lua methods are called with the ':' operator and properties accessed with the '.' operator. Properties are both readable and writeable by default and are otherwise marked "read-only" or "write-only".

## Text retrieval and modification

string editor:GetText() -- Retrieve all the text in the document. Returns number of characters retrieved. Result is NUL-terminated.

editor:SetText(string text) -- Replace the contents of the document with the argument text.

editor:SetSavePoint() -- Remember the current position in the undo history as the position at which the document was saved.

string editor:GetLine(int line) -- Retrieve the contents of a line. Returns the length of the line.

editor:ReplaceSel(string text) -- Replace the selected text with the argument text.

bool editor.ReadOnly -- Set to read only or read write.

editor:Allocate(int bytes) -- Enlarge the document to a particular size of text bytes.

editor:AddText(string text) -- Add text to the document at current position.

editor:AppendText(string text) -- Append a string to the end of the document without changing the selection.

editor:InsertText(position pos, string text) -- Insert string at a position.

editor:ChangeInsertion(string text) -- Change the text that is being inserted in response to SC_MOD_INSERTCHECK

editor:ClearAll() -- Delete all text in the document.

editor:DeleteRange(position start, int lengthDelete) -- Delete a range of text in the document.

editor:ClearDocumentStyle() -- Set all style bytes to 0, remove all folding information.

int editor.CharAt[position pos] read-only

int editor.StyleAt[position pos] read-only

editor:ReleaseAllExtendedStyles() -- Release all extended (>255) style numbers

int editor:AllocateExtendedStyles(int numberStyles) -- Allocate some extended (>255) style numbers and return the start of the range

string editor:TargetAsUTF8() -- Returns the target converted to UTF8. Return the length in bytes.

string editor:EncodedFromUTF8(string utf8) -- Translates a UTF8 string into the document encoding. Return the length of the result in bytes. On error return 0.

editor:SetLengthForEncode(int bytes) -- Set the length of the utf8 argument for calling EncodedFromUTF8. Set to -1 and the string will be measured to the first nul.

## Searching

position editor.TargetStart -- Sets the position that starts the target which is used for updating the document without affecting the scroll position.

position editor.TargetEnd -- Sets the position that ends the target which is used for updating the document without affecting the scroll position.

editor:SetTargetRange(position start, position end) -- Sets both the start and end of the target in one call.

editor:TargetFromSelection() -- Make the target range start and end be the same as the selection range start and end.

editor:TargetWholeDocument() -- Sets the target to the whole document.

int editor.SearchFlags -- Set the search flags used by SearchInTarget.

int editor:SearchInTarget(string text) -- Search for a counted string in the target and set the target to the found range. Text is counted so it can contain NULs. Returns length of range or -1 for failure in which case target is not moved.

string editor.TargetText read-only

int editor:ReplaceTarget(string text) -- Replace the target text with the argument text. Text is counted so it can contain NULs. Returns the length of the replacement text.

int editor:ReplaceTargetRE(string text) -- Replace the target text with the argument text after \d processing. Text is counted so it can contain NULs. Looks for \d where d is between 1 and 9 and replaces these with the strings matched in the last search operation which were surrounded by \( and \). Returns the length of the replacement text including any change caused by processing the \d patterns.

string editor.Tag[int tagNumber] read-only

editor:SearchAnchor() -- Sets the current caret position to be the search anchor.

int editor:SearchNext(int searchFlags, string text) -- Find some text starting at the search anchor. Does not ensure the selection is visible.

int editor:SearchPrev(int searchFlags, string text) -- Find some text starting at the search anchor and moving backwards. Does not ensure the selection is visible.

## Overtype

bool editor.Overtype -- Set to overtype (true) or insert mode.

## Cut, copy and paste

editor:Cut() -- Cut the selection to the clipboard.

editor:Copy() -- Copy the selection to the clipboard.

editor:Paste() -- Paste the contents of the clipboard into the document replacing the selection.

editor:Clear() -- Clear the selection.

bool editor:CanPaste() -- Will a paste succeed?

editor:CopyAllowLine() -- Copy the selection, if selection empty copy the line with the caret

editor:CopyRange(position start, position end) -- Copy a range of text to the clipboard. Positions are clipped into the document.

editor:CopyText(string text) -- Copy argument text to the clipboard.

bool editor.PasteConvertEndings -- Enable/Disable convert-on-paste for line endings

## Error handling

int editor.Status -- Change error status - 0 = OK.

## Undo and Redo

editor:Undo() -- Undo one action in the undo history.

bool editor:CanUndo() -- Are there any undoable actions in the undo history?

editor:Redo() -- Redoes the next action on the undo history.

bool editor:CanRedo() -- Are there any redoable actions in the undo history?

editor:EmptyUndoBuffer() -- Delete the undo history.

bool editor.UndoCollection -- Choose between collecting actions into the undo history and discarding them.

editor:BeginUndoAction() -- Start a sequence of actions that is undone and redone as a unit. May be nested.

editor:EndUndoAction() -- End a sequence of actions that is undone and redone as a unit.

editor:AddUndoAction(int token, int flags) -- Add a container action to the undo stack

## Selection and information

int editor.TextLength read-only

int editor.Length read-only

int editor.LineCount read-only

int editor.LinesOnScreen read-only

bool editor.Modify read-only

editor:SetSel(position anchor, position caret) -- Select a range of text.

editor:GotoPos(position caret) -- Set caret to a position and ensure it is visible.

editor:GotoLine(int line) -- Set caret to start of a line and ensure it is visible.

position editor.CurrentPos -- Sets the position of the caret.

position editor.Anchor -- Set the selection anchor to a position. The anchor is the opposite end of the selection from the caret.

position editor.SelectionStart -- Sets the position that starts the selection - this becomes the anchor.

position editor.SelectionEnd -- Sets the position that ends the selection - this becomes the caret.

editor:SetEmptySelection(position caret) -- Set caret to a position, while removing any existing selection.

editor:SelectAll() -- Select all the text in the document.

int editor:LineFromPosition(position pos) -- Retrieve the line containing a position.

position editor:PositionFromLine(int line) -- Retrieve the position at the start of a line.

position editor.LineEndPosition[int line] read-only

int editor:LineLength(int line) -- How many characters are on a line, including end of line characters?

string editor:GetSelText() -- Retrieve the selected text. Return the length of the text. Result is NUL-terminated.

string editor:GetCurLine() -- Retrieve the text of the line containing the caret. Returns the index of the caret on the line. Result is NUL-terminated.

bool editor.SelectionIsRectangle read-only

int editor.SelectionMode -- Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE/SC_SEL_THIN) or by lines (SC_SEL_LINES).

position editor:GetLineSelStartPosition(int line) -- Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line).

position editor:GetLineSelEndPosition(int line) -- Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line).

editor:MoveCaretInsideView() -- Move the caret inside current view if it's not there already.

position editor:PositionBefore(position pos) -- Given a valid document position, return the previous position taking code page into account. Returns 0 if passed 0.

position editor:PositionAfter(position pos) -- Given a valid document position, return the next position taking code page into account. Maximum value returned is the last position in the document.

position editor:PositionRelative(position pos, int relative) -- Given a valid document position, return a position that differs in a number of characters. Returned value is always between 0 and last position in document.

int editor:CountCharacters(position start, position end) -- Count characters between two positions.

int editor:TextWidth(int style, string text) -- Measure the pixel width of some text in a particular style. NUL terminated text argument. Does not handle tab or control characters.

int editor:TextHeight(int line) -- Retrieve the height of a particular line of text in pixels.

int editor.Column[position pos] read-only

int editor:FindColumn(int line, int column) -- Find the position of a column on a line taking into account tabs and multi-byte characters. If beyond end of line, return line end position.

position editor:PositionFromPoint(int x, int y) -- Find the position from a point within the window.

position editor:PositionFromPointClose(int x, int y) -- Find the position from a point within the window but return INVALID_POSITION if not close to text.

position editor:CharPositionFromPoint(int x, int y) -- Find the position of a character from a point within the window.

position editor:CharPositionFromPointClose(int x, int y) -- Find the position of a character from a point within the window. Return INVALID_POSITION if not close to text.

int editor:PointXFromPosition(position pos) -- Retrieve the x value of the point in the window where a position is displayed.

int editor:PointYFromPosition(position pos) -- Retrieve the y value of the point in the window where a position is displayed.

editor:HideSelection(bool hide) -- Draw the selection either highlighted or in normal (non-highlighted) style.

editor:ChooseCaretX() -- Set the last x chosen value to be the caret x position.

editor:MoveSelectedLinesUp() -- Move the selected lines up one line, shifting the line above after the selection

editor:MoveSelectedLinesDown() -- Move the selected lines down one line, shifting the line below before the selection

bool editor.MouseSelectionRectangularSwitch -- Set whether switching to rectangular mode while selecting with the mouse is allowed.

## Multiple Selection and Virtual Space

bool editor.MultipleSelection -- Set whether multiple selections can be made

bool editor.AdditionalSelectionTyping -- Set whether typing can be performed into multiple selections

int editor.MultiPaste -- Change the effect of pasting when there are multiple selections.

int editor.VirtualSpaceOptions -- Set options for virtual space behaviour.

int editor.RectangularSelectionModifier -- On GTK+, allow selecting the modifier key to use for mouse-based rectangular selection. Often the window manager requires Alt+Mouse Drag for moving windows. Valid values are SCMOD_CTRL(default), SCMOD_ALT, or SCMOD_SUPER.

int editor.Selections read-only

bool editor.SelectionEmpty read-only

editor:ClearSelections() -- Clear selections to a single empty stream selection

editor:SetSelection(position caret, position anchor) -- Set a simple selection

editor:AddSelection(position caret, position anchor) -- Add a selection

editor:DropSelectionN(int selection) -- Drop one selection

int editor.MainSelection -- Set the main selection

position editor.SelectionNCaret[int selection] -- Set the caret position of the nth selection.

int editor.SelectionNCaretVirtualSpace[int selection] -- Set the virtual space of the caret of the nth selection.

position editor.SelectionNAnchor[int selection] -- Set the anchor position of the nth selection.

int editor.SelectionNAnchorVirtualSpace[int selection] -- Set the virtual space of the anchor of the nth selection.

position editor.SelectionNStart[int selection] -- Sets the position that starts the selection - this becomes the anchor.

position editor.SelectionNEnd[int selection] -- Sets the position that ends the selection - this becomes the currentPosition.

position editor.RectangularSelectionCaret -- Set the caret position of the rectangular selection.

int editor.RectangularSelectionCaretVirtualSpace -- Set the virtual space of the caret of the rectangular selection.

position editor.RectangularSelectionAnchor -- Set the anchor position of the rectangular selection.

int editor.RectangularSelectionAnchorVirtualSpace -- Set the virtual space of the anchor of the rectangular selection.

int editor.AdditionalSelAlpha -- Set the alpha of the selection.

colour editor.AdditionalSelFore write-only -- Set the foreground colour of additional selections. Must have previously called SetSelFore with non-zero first argument for this to have an effect.

colour editor.AdditionalSelBack write-only -- Set the background colour of additional selections. Must have previously called SetSelBack with non-zero first argument for this to have an effect.

colour editor.AdditionalCaretFore -- Set the foreground colour of additional carets.

bool editor.AdditionalCaretsBlink -- Set whether additional carets will blink

bool editor.AdditionalCaretsVisible -- Set whether additional carets are visible

editor:SwapMainAnchorCaret() -- Swap that caret and anchor of the main selection.

editor:RotateSelection() -- Set the main selection to the next selection.

editor:MultipleSelectAddNext() -- Add the next occurrence of the main selection to the set of selections as main. If the current selection is empty then select word around caret.

editor:MultipleSelectAddEach() -- Add each occurrence of the main selection in the target to the set of selections. If the current selection is empty then select word around caret.

## Scrolling and automatic scrolling

int editor.FirstVisibleLine -- Scroll so that a display line is at the top of the display.

int editor.XOffset -- Set the xOffset (ie, horizontal scroll position).

editor:LineScroll(int columns, int lines) -- Scroll horizontally and vertically.

editor:ScrollCaret() -- Ensure the caret is visible.

editor:ScrollRange(position secondary, position primary) -- Scroll the argument positions and the range between them into view giving priority to the primary position then the secondary position. This may be used to make a search match visible.

editor:SetXCaretPolicy(int caretPolicy, int caretSlop) -- Set the way the caret is kept visible when going sideways. The exclusion zone is given in pixels.

editor:SetYCaretPolicy(int caretPolicy, int caretSlop) -- Set the way the line the caret is on is kept visible. The exclusion zone is given in lines.

editor:SetVisiblePolicy(int visiblePolicy, int visibleSlop) -- Set the way the display area is determined when a particular line is to be moved to by Find, FindNext, GotoLine, etc.

bool editor.HScrollBar -- Show or hide the horizontal scroll bar.

bool editor.VScrollBar -- Show or hide the vertical scroll bar.

int editor.ScrollWidth -- Sets the document width assumed for scrolling.

bool editor.ScrollWidthTracking -- Sets whether the maximum width line displayed is used to set scroll width.

bool editor.EndAtLastLine -- Sets the scroll range so that maximum scroll position has the last line at the bottom of the view (default). Setting this to false allows scrolling one page below the last line.

## White space

int editor.ViewWS -- Make white space characters invisible, always visible or visible outside indentation.

editor:SetWhitespaceFore(bool useSetting, colour fore) -- Set the foreground colour of all whitespace and whether to use this setting.

editor:SetWhitespaceBack(bool useSetting, colour back) -- Set the background colour of all whitespace and whether to use this setting.

int editor.WhitespaceSize -- Set the size of the dots used to mark space characters.

int editor.TabDrawMode -- Set how tabs are drawn when visible.

int editor.ExtraAscent -- Set extra ascent for each line

int editor.ExtraDescent -- Set extra descent for each line

## Cursor

int editor.Cursor -- Sets the cursor to one of the SC_CURSOR* values.

## Mouse capture

bool editor.MouseDownCaptures -- Set whether the mouse is captured when its button is pressed.

bool editor.MouseWheelCaptures -- Set whether the mouse wheel can be active outside the window.

## Line endings

int editor.EOLMode -- Set the current end of line mode.

editor:ConvertEOLs(int eolMode) -- Convert all line endings in the document to one mode.

bool editor.ViewEOL -- Make the end of line characters visible or invisible.

int editor.LineEndTypesSupported read-only

int editor.LineEndTypesAllowed -- Set the line end types that the application wants to use. May not be used if incompatible with lexer or encoding.

int editor.LineEndTypesActive read-only

## Words

int editor:WordEndPosition(position pos, bool onlyWordCharacters) -- Get position of end of word.

int editor:WordStartPosition(position pos, bool onlyWordCharacters) -- Get position of start of word.

bool editor:IsRangeWord(position start, position end) -- Is the range start..end considered a word?

string editor.WordChars -- Set the set of characters making up words for when moving or selecting by word. First sets defaults like SetCharsDefault.

string editor.WhitespaceChars -- Set the set of characters making up whitespace for when moving or selecting by word. Should be called after SetWordChars.

string editor.PunctuationChars -- Set the set of characters making up punctuation characters Should be called after SetWordChars.

editor:SetCharsDefault() -- Reset the set of characters for whitespace and word characters to the defaults.

## Styling

position editor.EndStyled read-only

editor:StartStyling(position start, int unused) -- Set the current styling position to start. The unused parameter is no longer used and should be set to 0.

editor:SetStyling(int length, int style) -- Change style from current styling position for length characters to a style and move the current styling position to after this newly styled segment.

editor:SetStylingEx(string styles) -- Set the styles for a segment of the document.

int editor.IdleStyling -- Sets limits to idle styling.

int editor.LineState[int line] -- Used to hold extra styling information for each line.

int editor.MaxLineState read-only

## Style definition

editor:StyleResetDefault() -- Reset the default style to its state at startup

editor:StyleClearAll() -- Clear all the styles and make equivalent to the global default style.

string editor.StyleFont[int style] -- Set the font of a style.

int editor.StyleSize[int style] -- Set the size of characters of a style.

int editor.StyleSizeFractional[int style] -- Set the size of characters of a style. Size is in points multiplied by 100.

bool editor.StyleBold[int style] -- Set a style to be bold or not.

int editor.StyleWeight[int style] -- Set the weight of characters of a style.

bool editor.StyleItalic[int style] -- Set a style to be italic or not.

bool editor.StyleUnderline[int style] -- Set a style to be underlined or not.

colour editor.StyleFore[int style] -- Set the foreground colour of a style.

colour editor.StyleBack[int style] -- Set the background colour of a style.

bool editor.StyleEOLFilled[int style] -- Set a style to have its end of line filled or not.

int editor.StyleCharacterSet[int style] -- Set the character set of the font in a style.

int editor.StyleCase[int style] -- Set a style to be mixed case, or to force upper or lower case.

bool editor.StyleVisible[int style] -- Set a style to be visible or not.

bool editor.StyleChangeable[int style] -- Set a style to be changeable or not (read only). Experimental feature, currently buggy.

bool editor.StyleHotSpot[int style] -- Set a style to be a hotspot or not.

## Caret, selection, and hotspot styles

editor:SetSelFore(bool useSetting, colour fore) -- Set the foreground colour of the main and additional selections and whether to use this setting.

editor:SetSelBack(bool useSetting, colour back) -- Set the background colour of the main and additional selections and whether to use this setting.

int editor.SelAlpha -- Set the alpha of the selection.

bool editor.SelEOLFilled -- Set the selection to have its end of line filled or not.

colour editor.CaretFore -- Set the foreground colour of the caret.

bool editor.CaretLineVisible -- Display the background of the line containing the caret in a different colour.

colour editor.CaretLineBack -- Set the colour of the background of the line containing the caret.

int editor.CaretLineBackAlpha -- Set background alpha of the caret line.

int editor.CaretLineFrame -- Display the caret line framed. Set width != 0 to enable this option and width = 0 to disable it.

bool editor.CaretLineVisibleAlways -- Sets the caret line to always visible.

int editor.CaretPeriod -- Get the time in milliseconds that the caret is on and off. 0 = steady on.

int editor.CaretStyle -- Set the style of the caret to be drawn.

int editor.CaretWidth -- Set the width of the insert mode caret.

editor:SetHotspotActiveFore(bool useSetting, colour fore) -- Set a fore colour for active hotspots.

colour editor:GetHotspotActiveFore() -- Get the fore colour for active hotspots.

editor:SetHotspotActiveBack(bool useSetting, colour back) -- Set a back colour for active hotspots.

colour editor:GetHotspotActiveBack() -- Get the back colour for active hotspots.

bool editor.HotspotActiveUnderline -- Enable / Disable underlining active hotspots.

bool editor.HotspotSingleLine -- Limit hotspots to single line so hotspots on two lines don't merge.

int editor.CaretSticky -- Stop the caret preferred x position changing when the user types.

editor:ToggleCaretSticky() -- Switch between sticky and non-sticky: meant to be bound to a key.

## Character representations

string editor.Representation[string encodedCharacter] -- Set the way a character is drawn.

editor:ClearRepresentation(string encodedCharacter) -- Remove a character representation.

int editor.ControlCharSymbol -- Change the way control characters are displayed: If symbol is < 32, keep the drawn way, else, use the given character.

## Margins

int editor.Margins -- Allocate a non-standard number of margins.

int editor.MarginTypeN[int margin] -- Set a margin to be either numeric or symbolic.

int editor.MarginWidthN[int margin] -- Set the width of a margin to a width expressed in pixels.

int editor.MarginMaskN[int margin] -- Set a mask that determines which markers are displayed in a margin.

bool editor.MarginSensitiveN[int margin] -- Make a margin sensitive or insensitive to mouse clicks.

int editor.MarginCursorN[int margin] -- Set the cursor shown when the mouse is inside a margin.

colour editor.MarginBackN[int margin] -- Set the background colour of a margin. Only visible for SC_MARGIN_COLOUR.

int editor.MarginLeft -- Sets the size in pixels of the left margin.

int editor.MarginRight -- Sets the size in pixels of the right margin.

editor:SetFoldMarginColour(bool useSetting, colour back) -- Set one of the colours used as a chequerboard pattern in the fold margin

editor:SetFoldMarginHiColour(bool useSetting, colour fore) -- Set the other colour used as a chequerboard pattern in the fold margin

string editor.MarginText[int line] -- Set the text in the text margin for a line

int editor.MarginStyle[int line] -- Set the style number for the text margin for a line

string editor.MarginStyles[int line] -- Set the style in the text margin for a line

editor:MarginTextClearAll() -- Clear the margin text on all lines

int editor.MarginStyleOffset -- Get the start of the range of style numbers used for margin text

int editor.MarginOptions -- Set the margin options.

## Annotations

string editor.AnnotationText[int line] -- Set the annotation text for a line

int editor.AnnotationStyle[int line] -- Set the style number for the annotations for a line

string editor.AnnotationStyles[int line] -- Set the annotation styles for a line

int editor.AnnotationLines[int line] read-only

editor:AnnotationClearAll() -- Clear the annotations from all lines

int editor.AnnotationVisible -- Set the visibility for the annotations for a view

int editor.AnnotationStyleOffset -- Get the start of the range of style numbers used for annotations

## Other settings

bool editor.BufferedDraw -- If drawing is buffered then each line of text is drawn into a bitmap buffer before drawing it to the screen to avoid flicker.

int editor.PhasesDraw -- In one phase draw, text is drawn in a series of rectangular blocks with no overlap. In two phase draw, text is drawn in a series of lines allowing runs to overlap horizontally. In multiple phase draw, each element is drawn over the whole drawing area, allowing text to overlap from one line to the next.

int editor.Technology -- Set the technology used.

int editor.FontQuality -- Choose the quality level for text from the FontQuality enumeration.

int editor.CodePage -- Set the code page used to interpret the bytes of the document as characters. The SC_CP_UTF8 value can be used to enter Unicode mode.

int editor.IMEInteraction -- Choose to display the the IME in a winow or inline.

editor:GrabFocus() -- Set the focus to this Scintilla widget.

bool editor.Focus -- Change internal focus flag.

## Brace highlighting

editor:BraceHighlight(position posA, position posB) -- Highlight the characters at two positions.

editor:BraceBadLight(position pos) -- Highlight the character at a position indicating there is no matching brace.

editor:BraceHighlightIndicator(bool useSetting, int indicator) -- Use specified indicator to highlight matching braces instead of changing their style.

editor:BraceBadLightIndicator(bool useSetting, int indicator) -- Use specified indicator to highlight non matching brace instead of changing its style.

position editor:BraceMatch(position pos, int maxReStyle) -- Find the position of a matching brace or INVALID_POSITION if no match. The maxReStyle must be 0 for now. It may be defined in a future release.

## Tabs and Indentation Guides

int editor.TabWidth -- Change the visible size of a tab to be a multiple of the width of a space character.

editor:ClearTabStops(int line) -- Clear explicit tabstops on a line.

editor:AddTabStop(int line, int x) -- Add an explicit tab stop for a line.

int editor:GetNextTabStop(int line, int x) -- Find the next explicit tab stop position on a line after a position.

bool editor.UseTabs -- Indentation will only use space characters if useTabs is false, otherwise it will use a combination of tabs and spaces.

int editor.Indent -- Set the number of spaces used for one level of indentation.

bool editor.TabIndents -- Sets whether a tab pressed when caret is within indentation indents.

bool editor.BackSpaceUnIndents -- Sets whether a backspace pressed when caret is within indentation unindents.

int editor.LineIndentation[int line] -- Change the indentation of a line to a number of columns.

position editor.LineIndentPosition[int line] read-only

int editor.IndentationGuides -- Show or hide indentation guides.

int editor.HighlightGuide -- Set the highlighted indentation guide column. 0 = no highlighted guide.

## Markers

editor:MarkerDefine(int markerNumber, int markerSymbol) -- Set the symbol used for a particular marker number.

editor:MarkerDefinePixmap(int markerNumber, string pixmap) -- Define a marker from a pixmap.

int editor.RGBAImageWidth write-only -- Set the width for future RGBA image data.

int editor.RGBAImageHeight write-only -- Set the height for future RGBA image data.

int editor.RGBAImageScale write-only -- Set the scale factor in percent for future RGBA image data.

editor:MarkerDefineRGBAImage(int markerNumber, string pixels) -- Define a marker from RGBA data. It has the width and height from RGBAImageSetWidth/Height

int editor:MarkerSymbolDefined(int markerNumber) -- Which symbol was defined for markerNumber with MarkerDefine

colour editor.MarkerFore[int markerNumber] write-only -- Set the foreground colour used for a particular marker number.

colour editor.MarkerBack[int markerNumber] write-only -- Set the background colour used for a particular marker number.

colour editor.MarkerBackSelected[int markerNumber] write-only -- Set the background colour used for a particular marker number when its folding block is selected.

editor:MarkerEnableHighlight(bool enabled) -- Enable/disable highlight for current folding bloc (smallest one that contains the caret)

int editor.MarkerAlpha[int markerNumber] write-only -- Set the alpha used for a marker that is drawn in the text area, not the margin.

int editor:MarkerAdd(int line, int markerNumber) -- Add a marker to a line, returning an ID which can be used to find or delete the marker.

editor:MarkerAddSet(int line, int markerSet) -- Add a set of markers to a line.

editor:MarkerDelete(int line, int markerNumber) -- Delete a marker from a line.

editor:MarkerDeleteAll(int markerNumber) -- Delete all markers with a particular number from all lines.

int editor:MarkerGet(int line) -- Get a bit mask of all the markers set on a line.

int editor:MarkerNext(int lineStart, int markerMask) -- Find the next line at or after lineStart that includes a marker in mask. Return -1 when no more lines.

int editor:MarkerPrevious(int lineStart, int markerMask) -- Find the previous line before lineStart that includes a marker in mask.

int editor:MarkerLineFromHandle(int markerHandle) -- Retrieve the line number at which a particular marker is located.

editor:MarkerDeleteHandle(int markerHandle) -- Delete a marker.

## Indicators

int editor.IndicStyle[int indicator] -- Set an indicator to plain, squiggle or TT.

colour editor.IndicFore[int indicator] -- Set the foreground colour of an indicator.

int editor.IndicAlpha[int indicator] -- Set the alpha fill colour of the given indicator.

int editor.IndicOutlineAlpha[int indicator] -- Set the alpha outline colour of the given indicator.

bool editor.IndicUnder[int indicator] -- Set an indicator to draw under text or over(default).

int editor.IndicHoverStyle[int indicator] -- Set a hover indicator to plain, squiggle or TT.

colour editor.IndicHoverFore[int indicator] -- Set the foreground hover colour of an indicator.

int editor.IndicFlags[int indicator] -- Set the attributes of an indicator.

int editor.IndicatorCurrent -- Set the indicator used for IndicatorFillRange and IndicatorClearRange

int editor.IndicatorValue -- Set the value used for IndicatorFillRange

editor:IndicatorFillRange(position start, int lengthFill) -- Turn a indicator on over a range.

editor:IndicatorClearRange(position start, int lengthClear) -- Turn a indicator off over a range.

int editor:IndicatorAllOnFor(position pos) -- Are any indicators present at pos?

int editor:IndicatorValueAt(int indicator, position pos) -- What value does a particular indicator have at a position?

int editor:IndicatorStart(int indicator, position pos) -- Where does a particular indicator start?

int editor:IndicatorEnd(int indicator, position pos) -- Where does a particular indicator end?

editor:FindIndicatorShow(position start, position end) -- On OS X, show a find indicator.

editor:FindIndicatorFlash(position start, position end) -- On OS X, flash a find indicator, then fade out.

editor:FindIndicatorHide() -- On OS X, hide the find indicator.

## Autocompletion

editor:AutoCShow(int lengthEntered, string itemList) -- Display a auto-completion list. The lengthEntered parameter indicates how many characters before the caret should be used to provide context.

editor:AutoCCancel() -- Remove the auto-completion list from the screen.

bool editor:AutoCActive() -- Is there an auto-completion list visible?

position editor:AutoCPosStart() -- Retrieve the position of the caret when the auto-completion list was displayed.

editor:AutoCComplete() -- User has selected an item so remove the list and insert the selection.

editor:AutoCStops(string characterSet) -- Define a set of character that when typed cancel the auto-completion list.

int editor.AutoCSeparator -- Change the separator character in the string setting up an auto-completion list. Default is space but can be changed if items contain space.

editor:AutoCSelect(string select) -- Select the item in the auto-completion list that starts with a string.

int editor.AutoCCurrent read-only

string editor.AutoCCurrentText read-only

bool editor.AutoCCancelAtStart -- Should the auto-completion list be cancelled if the user backspaces to a position before where the box was created.

string editor.AutoCFillUps write-only -- Define a set of characters that when typed will cause the autocompletion to choose the selected item.

bool editor.AutoCChooseSingle -- Should a single item auto-completion list automatically choose the item.

bool editor.AutoCIgnoreCase -- Set whether case is significant when performing auto-completion searches.

int editor.AutoCCaseInsensitiveBehaviour -- Set auto-completion case insensitive behaviour to either prefer case-sensitive matches or have no preference.

int editor.AutoCMulti -- Change the effect of autocompleting when there are multiple selections.

int editor.AutoCOrder -- Set the way autocompletion lists are ordered.

bool editor.AutoCAutoHide -- Set whether or not autocompletion is hidden automatically when nothing matches.

bool editor.AutoCDropRestOfWord -- Set whether or not autocompletion deletes any word characters after the inserted text upon completion.

editor:RegisterImage(int type, string xpmData) -- Register an XPM image for use in autocompletion lists.

editor:RegisterRGBAImage(int type, string pixels) -- Register an RGBA image for use in autocompletion lists. It has the width and height from RGBAImageSetWidth/Height

editor:ClearRegisteredImages() -- Clear all the registered XPM images.

int editor.AutoCTypeSeparator -- Change the type-separator character in the string setting up an auto-completion list. Default is '?' but can be changed if items contain '?'.

int editor.AutoCMaxHeight -- Set the maximum height, in rows, of auto-completion and user lists. The default is 5 rows.

int editor.AutoCMaxWidth -- Set the maximum width, in characters, of auto-completion and user lists. Set to 0 to autosize to fit longest item, which is the default.

## User lists

editor:UserListShow(int listType, string itemList) -- Display a list of strings and send notification when user chooses one.

## Call tips

editor:CallTipShow(position pos, string definition) -- Show a call tip containing a definition near position pos.

editor:CallTipCancel() -- Remove the call tip from the screen.

bool editor:CallTipActive() -- Is there an active call tip?

position editor:CallTipPosStart() -- Retrieve the position where the caret was before displaying the call tip.

int editor.CallTipPosStart write-only -- Set the start position in order to change when backspacing removes the calltip.

editor:CallTipSetHlt(int highlightStart, int highlightEnd) -- Highlight a segment of the definition.

colour editor.CallTipBack write-only -- Set the background colour for the call tip.

colour editor.CallTipFore write-only -- Set the foreground colour for the call tip.

colour editor.CallTipForeHlt write-only -- Set the foreground colour for the highlighted part of the call tip.

int editor.CallTipUseStyle write-only -- Enable use of STYLE_CALLTIP and set call tip tab size in pixels.

bool editor.CallTipPosition write-only -- Set position of calltip, above or below text.

## Key bindings

editor:AssignCmdKey(keymod keyDefinition, int sciCommand) -- When key+modifier combination keyDefinition is pressed perform sciCommand.

editor:ClearCmdKey(keymod keyDefinition) -- When key+modifier combination keyDefinition is pressed do nothing.

editor:ClearAllCmdKeys() -- Drop all key mappings.

editor:Null() -- Null operation.

## Popup edit menu

editor:UsePopUp(int popUpMode) -- Set whether a pop up menu is displayed automatically when the user presses the wrong mouse button on certain areas.

## Macro recording

editor:StartRecord() -- Start notifying the container of all key presses and commands.

editor:StopRecord() -- Stop notifying the container of all key presses and commands.

## Printing

int editor.PrintMagnification -- Sets the print magnification added to the point size of each style for printing.

int editor.PrintColourMode -- Modify colours when printing for clearer printed text.

int editor.PrintWrapMode -- Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE).

## Direct access

int editor.DirectFunction read-only

int editor.DirectPointer read-only

int editor.CharacterPointer read-only

int editor:GetRangePointer(position start, int lengthRange) -- Return a read-only pointer to a range of characters in the document. May move the gap so that the range is contiguous, but will only move up to lengthRange bytes.

position editor.GapPosition read-only

## Multiple views

int editor.DocPointer -- Change the document object used.

int editor:CreateDocument() -- Create a new document object. Starts with reference count of 1 and not selected into editor.

editor:AddRefDocument(int doc) -- Extend life of document.

editor:ReleaseDocument(int doc) -- Release a reference to the document, deleting document if it fades to black.

## Background loading and saving

int editor:CreateLoader(int bytes) -- Create an ILoader*.

## Folding

int editor:VisibleFromDocLine(int docLine) -- Find the display line of a document line taking hidden lines into account.

int editor:DocLineFromVisible(int displayLine) -- Find the document line of a display line taking hidden lines into account.

editor:ShowLines(int lineStart, int lineEnd) -- Make a range of lines visible.

editor:HideLines(int lineStart, int lineEnd) -- Make a range of lines invisible.

bool editor.LineVisible[int line] read-only

bool editor.AllLinesVisible read-only

int editor.FoldLevel[int line] -- Set the fold level of a line. This encodes an integer level along with flags indicating whether the line is a header and whether it is effectively white space.

int editor.FoldFlags write-only -- Set some style options for folding.

int editor:GetLastChild(int line, int level) -- Find the last child line of a header line.

int editor.FoldParent[int line] read-only

editor:ToggleFold(int line) -- Switch a header line between expanded and contracted.

editor:ToggleFoldShowText(int line, string text) -- Switch a header line between expanded and contracted and show some text after the line.

int editor.FoldDisplayTextStyle write-only -- Set the style of fold display text

bool editor.FoldExpanded[int line] -- Show the children of a header line.

editor:FoldLine(int line, int action) -- Expand or contract a fold header.

editor:FoldChildren(int line, int action) -- Expand or contract a fold header and its children.

editor:FoldAll(int action) -- Expand or contract all fold headers.

editor:ExpandChildren(int line, int level) -- Expand a fold header and all children. Use the level argument instead of the line's current level.

int editor.AutomaticFold -- Set automatic folding behaviours.

int editor:ContractedFoldNext(int lineStart) -- Find the next line at or after lineStart that is a contracted fold header line. Return -1 when no more lines.

editor:EnsureVisible(int line) -- Ensure a particular line is visible by expanding any header line hiding it.

editor:EnsureVisibleEnforcePolicy(int line) -- Ensure a particular line is visible by expanding any header line hiding it. Use the currently set visibility policy to determine which range to display.

## Line wrapping

int editor.WrapMode -- Sets whether text is word wrapped.

int editor.WrapVisualFlags -- Set the display mode of visual flags for wrapped lines.

int editor.WrapVisualFlagsLocation -- Set the location of visual flags for wrapped lines.

int editor.WrapIndentMode -- Sets how wrapped sublines are placed. Default is fixed.

int editor.WrapStartIndent -- Set the start indent for wrapped lines.

int editor.LayoutCache -- Sets the degree of caching of layout information.

int editor.PositionCache -- Set number of entries in position cache

editor:LinesSplit(int pixelWidth) -- Split the lines in the target into lines that are less wide than pixelWidth where possible.

editor:LinesJoin() -- Join the lines in the target.

int editor:WrapCount(int docLine) -- The number of display lines needed to wrap a document line

## Zooming

editor:ZoomIn() -- Magnify the displayed text by increasing the sizes by 1 point.

editor:ZoomOut() -- Make the displayed text smaller by decreasing the sizes by 1 point.

int editor.Zoom -- Set the zoom level. This number of points is added to the size of all fonts. It may be positive to magnify or negative to reduce.

## Long lines

int editor.EdgeMode -- The edge may be displayed by a line (EDGE_LINE/EDGE_MULTILINE) or by highlighting text that goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE).

int editor.EdgeColumn -- Set the column number of the edge. If text goes past the edge then it is highlighted.

colour editor.EdgeColour -- Change the colour used in edge indication.

editor:MultiEdgeAddLine(int column, colour edgeColour) -- Add a new vertical edge to the view.

editor:MultiEdgeClearAll() -- Clear all vertical edges.

## Accessibility

int editor.Accessibility -- Enable or disable accessibility.

## Lexer

int editor.Lexer -- Set the lexing language of the document.

string editor.LexerLanguage -- Set the lexing language of the document based on string name.

editor:LoadLexerLibrary(string path) -- Load a lexer library (dll / so).

editor:Colourise(position start, position end) -- Colourise a segment of the document using the current lexing language.

int editor:ChangeLexerState(position start, position end) -- Indicate that the internal state of a lexer has changed over a range and therefore there may be a need to redraw.

string editor:PropertyNames() -- Retrieve a '\n' separated list of properties understood by the current lexer. Result is NUL-terminated.

int editor:PropertyType(string name) -- Retrieve the type of a property.

string editor:DescribeProperty(string name) -- Describe a property. Result is NUL-terminated.

string editor.Property[string key] -- Set up a value that may be used by a lexer for some optional feature.

string editor.PropertyExpanded[string key] read-only

int editor:GetPropertyInt(string key, int defaultValue) -- Retrieve a "property" value previously set with SetProperty, interpreted as an int AFTER any "$()" variable replacement.

string editor.KeyWords[int keyWordSet] write-only -- Set up the key words used by the lexer.

string editor:DescribeKeyWordSets() -- Retrieve a '\n' separated list of descriptions of the keyword sets understood by the current lexer. Result is NUL-terminated.

string editor.SubStyleBases read-only

int editor.DistanceToSecondaryStyles read-only

int editor:AllocateSubStyles(int styleBase, int numberStyles) -- Allocate a set of sub styles for a particular base style, returning start of range

editor:FreeSubStyles() -- Free allocated sub styles

int editor.SubStylesStart[int styleBase] read-only

int editor.SubStylesLength[int styleBase] read-only

int editor.StyleFromSubStyle[int subStyle] read-only

int editor.PrimaryStyleFromStyle[int style] read-only

string editor.Identifiers[int style] write-only -- Set the identifiers that are shown in a particular style

int editor:PrivateLexerCall(int operation, int pointer) -- For private communication between an application and a known lexer.

## Notifications

int editor.Identifier -- Set the identifier reported as idFrom in notification messages.

int editor.ModEventMask -- Set which document modification events are sent to the container.

int editor.MouseDwellTime -- Sets the time the mouse must sit still to generate a mouse dwell event.

## Deprecated messages and notifications

int editor.StyleBitsNeeded read-only