Scintilla icon 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.

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:ClearAll() -- Delete all text in the document.

editor:DeleteRange(position pos, int deleteLength) -- 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

int editor.StyleBits -- Divide each styling byte into lexical class bits (default: 5) and indicator bits (default: 3). If a lexer requires more than 32 lexical states, then this is used to expand the possible states.

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

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

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

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

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:TargetFromSelection() -- Make the target range start and end be the same as the selection range start and end.

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.

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

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.FirstVisibleLine -- Scroll so that a display line is at the top of the display.

int editor.LinesOnScreen read-only

bool editor.Modify read-only

editor:SetSel(position start, position end) -- Select a range of text.

editor:GotoPos(position pos) -- 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 currentPosition.

editor:SetEmptySelection(position pos) -- 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.

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

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.

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.

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.

int editor:CountCharacters(int startPos, int endPos) -- 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 normal) -- Draw the selection in normal style or with selection highlighted.

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

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 -- Returns the position at the end of the selection.

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

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

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

int editor.MainSelection -- Set the main selection

position editor.SelectionNCaret[int selection] -- Which selection is the main selection

int editor.SelectionNCaretVirtualSpace[int selection] -- Which selection is the main selection

position editor.SelectionNAnchor[int selection] -- Which selection is the main selection

int editor.SelectionNAnchorVirtualSpace[int selection] -- Which selection is the main 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 -- Returns the position at the end of the selection.

int editor.RectangularSelectionCaretVirtualSpace -- Returns the position at the end of the selection.

position editor.RectangularSelectionAnchor -- Returns the position at the end of the selection.

int editor.RectangularSelectionAnchorVirtualSpace -- Returns the position at the end of the 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.

Scrolling and automatic scrolling

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

editor:ScrollCaret() -- Ensure the caret is 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.XOffset -- Get and Set the xOffset (ie, horizontal scroll position).

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.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.

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.

Styling

position editor.EndStyled read-only

editor:StartStyling(position pos, int mask) -- Set the current styling position to pos and the styling mask to mask. The styling mask can be used to protect some bits in each styling byte from modification.

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.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.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.ControlCharSymbol -- Change the way control characters are displayed: If symbol is < 32, keep the drawn way, else, use the given character.

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.

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.

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 the colours used as a chequerboard pattern in the fold margin

editor:SetFoldMarginHiColour(bool useSetting, colour fore) -- Set the colours 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.

bool editor.TwoPhaseDraw -- In twoPhaseDraw mode, drawing is performed in two phases, first the background and then the foreground. This avoids chopping off characters that overlap the next run.

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.

bool editor.KeysUnicode -- Always interpret keyboard input as Unicode

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.

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

bool editor.Focus -- Change internal focus flag.

Brace highlighting

editor:BraceHighlight(position pos1, position pos2) -- Highlight the characters at two positions.

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

position editor:BraceMatch(position pos) -- Find the position of a matching brace or INVALID_POSITION if no match.

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.

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 set) -- 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 handle) -- Retrieve the line number at which a particular marker is located.

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

Indicators

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

colour editor.IndicFore[int indic] -- 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 indic] -- Set an indicator to draw under text or over(default).

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

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

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

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

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

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

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

int editor:IndicatorEnd(int indicator, int position) -- 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 lenEntered, string itemList) -- Display a auto-completion list. The lenEntered 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 text) -- 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.

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.

editor:CallTipSetHlt(int start, int end) -- 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 km, int msg) -- When key+modifier combination km is pressed perform msg.

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

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

editor:Null() -- Null operation.

Popup edit menu

editor:UsePopUp(bool allowPopUp) -- Set whether a pop up menu is displayed automatically when the user presses the wrong mouse button.

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(int position, int rangeLength) -- 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 rangeLength 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 line) -- Find the display line of a document line taking hidden lines into account.

int editor:DocLineFromVisible(int lineDisplay) -- 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.

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

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 line) -- 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) 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.

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.

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

string editor:DescribeProperty(string name) -- Describe a property.

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.PropertyInt[string key] read-only

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.

int editor.StyleBitsNeeded read-only

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.