Donner SVG main
0.8.0 · 382bd0190.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::editor::TextEditorCore Class Reference

Headless editing substrate - the text buffer, cursor, undo history and syntax colorizer with no ImGui dependency. More...

#include "donner/editor/TextEditorCore.h"

Public Types

using UndoBuffer
 Chronological editing records retained for undo and redo.

Public Member Functions

 TextEditorCore (const TextEditorCore &)=delete
TextEditorCore & operator= (const TextEditorCore &)=delete
 TextEditorCore (TextEditorCore &&)=delete
TextEditorCore & operator= (TextEditorCore &&)=delete
void setText (std::string_view text, bool preserveScroll=false)
 Replace the buffer contents with text. By default this scrolls the view back to the top - appropriate for File→Open and similar "load a different document" flows. Pass preserveScroll=true when the replacement is a small in-place edit (e.g. canvas→text writeback after a transform drag) so the user's scroll position isn't yanked out from under them. The cursor and selection are kept where they still fit and otherwise clamped into the new text.
void applyExternalSourceEdit (std::size_t offset, std::size_t removedLength, std::string_view replacement)
 Apply a source-view update that originated outside the text editor.
std::string getText () const
 Return the entire editable text buffer.
std::string getText (const Coordinates &start, const Coordinates &end) const
 Return the text in the half-open coordinate range.
Coordinates getCoordinatesAtByteOffset (std::size_t offset) const
 Resolve a full-buffer byte offset to editor coordinates.
bool isTextChanged () const
 Report whether the text changed since the last reset; external source mirroring clears it.
void resetTextChanged ()
 Clear the text-change flag and recorded changed lines.
bool hasPendingSourceEditIntents () const
 True if user-facing edits have pending byte-level source intents.
std::vector< SourceEditIntent > takePendingSourceEditIntents ()
 Consume pending byte-level source intents captured from user-facing edits.
Coordinates getCursorPosition () const
 Return the cursor position clamped to the current buffer.
void setCursorPosition (const Coordinates &position)
 Store a requested cursor position; reads clamp it to the current buffer.
void setSelection (const Coordinates &start, const Coordinates &end, SelectionMode mode=SelectionMode::Normal)
 Select between two endpoints, storing ordered bounds and expanding words or lines.
void setInteractiveSelection (const Coordinates &start, const Coordinates &end, SelectionMode mode=SelectionMode::Normal)
 Update the visible selection during an active mouse interaction while preserving the raw anchor/current endpoints in interactiveStart_/End_.
void setSelectionStart (const Coordinates &position)
 Replace the ordered lower selection bound, swapping bounds if needed.
void setSelectionEnd (const Coordinates &position)
 Replace the ordered upper selection bound, swapping bounds if needed.
const Coordinates & getSelectionStart () const
 Return the ordered lower selection bound.
const Coordinates & getSelectionEnd () const
 Return the ordered upper selection bound.
bool hasSelection () const
 Report whether the selection spans any text.
std::string getSelectedText () const
 Return the text covered by the current selection.
void selectAll ()
 Select the entire text buffer.
void selectWordUnderCursor ()
 Select the word containing the cursor.
void moveUp (int amount=1, bool select=false)
 Move the cursor up by logical lines.
void moveDown (int amount=1, bool select=false)
 Move the cursor down by logical lines.
void moveLeft (int amount=1, bool select=false, bool wordMode=false)
 Move the cursor left by characters or words.
void moveRight (int amount=1, bool select=false, bool wordMode=false)
 Move the cursor right by characters or words.
void moveTop (bool select=false)
 Move the cursor to the start of the buffer.
void moveBottom (bool select=false)
 Move the cursor to the end of the final line.
void moveCursorTo (const Coordinates &position, bool select)
 Move the cursor to position. With select the selection extends from its anchor, the end the cursor did not occupy; otherwise it collapses to the cursor.
void moveHome (bool select=false)
 Move the cursor to the start of its current line.
void moveEnd (bool select=false)
 Move the cursor to the end of its current line.
void enterCharacter (char32_t character, bool shift)
 Insert one character at the cursor or replace the selection.
void insertText (std::string_view text, bool indent=false)
 Insert text at the cursor, optionally applying indentation.
int insertTextAt (Coordinates &where, std::string_view text, bool indent=false)
 Insert text at a coordinate and update that coordinate as lines are added.
void deleteRange (const Coordinates &start, const Coordinates &end)
 Delete the text between two coordinates.
void deleteSelection ()
 Delete the current selection and update the cursor.
void backspace ()
 Remove the character before the cursor or the current selection.
void delete_ ()
 Remove the character after the cursor or the current selection.
bool canUndo () const
 Report whether an earlier edit can be undone.
bool canRedo () const
 Report whether a previously undone edit can be redone.
void undo (int steps=1)
 Undo the requested number of edits.
void redo (int steps=1)
 Redo the requested number of edits.
void addUndo (UndoRecord &value)
 Append an edit to undo history and discard any redo tail.
void setLanguageDefinition (const LanguageDefinition &langDef)
 Set the syntax rules and schedule the buffer for recoloring.
void setSvgLanguageDefinition ()
 Use the built-in SVG syntax rules.
const LanguageDefinition & getLanguageDefinition () const
 Return the active syntax language definition.
void colorize (int fromLine=0, int count=-1)
 Schedule syntax coloring for a line range.
void colorizeRange (int fromLine=0, int toLine=0)
 Recolor the half-open line range [fromLine, toLine).
void colorizeInternal ()
 Process the pending syntax-coloring range.
bool isColorizerEnabled () const
 Report whether syntax coloring is enabled.
void setColorizerEnabled (bool enabled)
 Enable or disable syntax coloring.
void setPalette (const Palette &value)
 Set the base color palette used by the text editor.
const Palette & getPalette () const
 Return the configured base color palette.
void setTabSize (int size)
 Set the number of columns represented by one tab, clamped to 0 through 32.
int getTabSize () const
 Return the configured tab width in columns.
void setInsertSpaces (bool value)
 Choose whether indentation inserts spaces rather than tabs.
bool getInsertSpaces () const
 Report whether indentation inserts spaces.
void setSmartIndent (bool value)
 Enable or disable context-sensitive indentation.
void setAutoIndentOnPaste (bool value)
 Enable or disable indentation of pasted lines.
void setCompleteBraces (bool value)
 Enable or disable automatic closing-brace insertion.
void setActiveAutocomplete (bool value)
 Enable or disable active autocomplete requests.
void setScrollbarMarkers (bool value)
 Show or hide changed-line markers in the scrollbar.
bool & scrollbarMarkersRef ()
 Expose the scrollbar-marker flag to the rendering shell.
void setErrorMarkers (const ErrorMarkers &markers)
 Replace the line-numbered diagnostic markers.
const ErrorMarkers & getErrorMarkers () const
 Return the current line-numbered diagnostic markers.
ErrorMarkers & mutableErrorMarkers ()
 Expose diagnostic markers for shell-side edits.
Coordinates findWordStart (const Coordinates &from) const
 Find the start of the word containing or preceding a coordinate.
Coordinates findWordEnd (const Coordinates &from) const
 Find the end of the word containing or following a coordinate.
Coordinates findNextWord (const Coordinates &from) const
 Find the next word boundary after a coordinate.
bool isOnWordBoundary (const Coordinates &at) const
 Report whether a coordinate lies on a word boundary.
RcString getWordUnderCursor () const
 Return the word at the current cursor position.
RcString getWordAt (const Coordinates &coords) const
 Return the word containing a coordinate.
Coordinates findFirst (std::string_view searchText, const Coordinates &start) const
 Find the first whole-word match at or after a coordinate.
Coordinates getActualCursorCoordinates () const
 Return the cursor clamped to the current buffer.
Coordinates sanitizeCoordinates (const Coordinates &value) const
 Clamp a coordinate to an existing line and column.
void advance (Coordinates &coordinates) const
 Advance a coordinate by one UTF-8 character, crossing lines as needed.
TextBuffer & buffer ()
 Expose the editable buffer for shell-side mutation.
const TextBuffer & buffer () const
 Return the editable buffer for shell-side rendering.
EditorState & mutableState ()
 Expose cursor and selection state for shell-side mutation.
const EditorState & state () const
 Return the current cursor and selection state.
const UndoBuffer & undoBuffer () const
 Return the retained undo records in chronological order.
int undoIndex () const
 Return the current position in the undo history.
std::vector< int > & changedLines ()
 Expose changed-line markers for shell-side updates.
const std::vector< int > & changedLines () const
 Return the changed-line markers used by the scrollbar.
std::vector< Coordinates > & foldBegin ()
 Expose positions of opening fold markers.
const std::vector< Coordinates > & foldBegin () const
 Return positions of opening fold markers.
std::vector< Coordinates > & foldEnd ()
 Expose positions of closing fold markers.
const std::vector< Coordinates > & foldEnd () const
 Return positions of closing fold markers.
bool & foldSorted ()
 Expose whether the fold-marker arrays are sorted.
SelectionMode selectionMode () const
 Return the current character, word, or line selection mode.
void setSelectionMode (SelectionMode mode)
 Set how selection boundaries are expanded.
Coordinates & interactiveStart ()
 Expose the raw interactive selection anchor.
Coordinates & interactiveEnd ()
 Expose the raw interactive selection extent.
Palette & mutablePalette ()
 Expose the active color palette to the rendering shell.
const Palette & livePalette () const
 Return the active color palette used for glyphs.
Palette & mutablePaletteBase ()
 Expose the configured base palette to the rendering shell.
bool scrollToCursorRequested () const
 Report whether the shell should scroll the cursor into view.
void clearScrollToCursor ()
 Clear a pending scroll-to-cursor request.
void requestScrollToCursor ()
 Request that the shell scroll the cursor into view.
bool & scrollToCursorRef ()
 Expose the scroll-to-cursor request flag to the shell.
bool scrollToTopRequested () const
 Report whether the shell should scroll to the top.
void clearScrollToTop ()
 Clear a pending scroll-to-top request.
bool & scrollToTopRef ()
 Expose the scroll-to-top request flag to the shell.
bool cursorPositionChanged () const
 Report whether the cursor moved since the last shell update.
void setCursorPositionChanged (bool value)
 Set the cursor-position-change flag.
bool & cursorPositionChangedRef ()
 Expose the cursor-position-change flag to the shell.
int replaceIndex () const
 Return the active replacement index used by the text shell.
void setReplaceIndex (int index)
 Set the replacement index used by the text shell.
int & replaceIndexRef ()
 Expose the replacement index to the text shell.
int & tabSizeRef ()
 Expose the configured tab width for shell-side editing.
SelectionMode & selectionModeRef ()
 Expose the selection mode for shell-side editing.
bool & textChangedRef ()
 Expose the text-change flag for shell-side editing.
bool & autoIndentOnPasteRef ()
 Expose the paste-indentation setting for shell-side editing.
unsigned int getGlyphColor (const Glyph &glyph) const
 Return the active palette color for a glyph and its comment state.
void removeLine (int start, int end)
 Remove an inclusive range of lines and update error and changed-line markers.
void removeLine (int index)
 Remove one line and update fold, marker, and change positions.
Line & insertLine (int index, int column)
 Insert a blank line at index, or split the line at index when column is nonzero. Fold and error-marker positions are updated after insertion.
void removeFolds (const Coordinates &start, const Coordinates &end)
 Remove fold markers in a coordinate range.
void removeFolds (std::vector< Coordinates > &folds, const Coordinates &start, const Coordinates &end)
 Remove fold markers from one marker array in a coordinate range.
void detectIndentationStyle ()
 Infer whether the current text is indented with tabs or spaces.
void handleNewLine (UndoState &state, const Coordinates &coord, bool smartIndent)
 Insert a newline and record its undo state and indentation.
void handleRegularCharacter (UndoState &state, const Coordinates &coord, char32_t character)
 Insert a regular character and update its undo state.
void handleEndOfLineDelete (Coordinates pos, UndoRecord &undo)
 Delete the line break at the end of a line and record the edit.
void handleMidLineDelete (Coordinates pos, UndoRecord &undo)
 Delete a character within a line and record the edit.
void handleStartOfLineDelete (const Coordinates &pos, UndoRecord &undo)
 Delete at the start of a line and record the edit.
void handleMidLineBackspace (const Coordinates &pos, UndoRecord &undo)
 Backspace within a line and record the edit.
void recordSourceEditIntent (const UndoRecord &record, SourceEditIntentKind kind)
 Convert an undo record into a byte-level source edit intent.
void appendSourceEditIntent (SourceEditIntent intent)
 Queue a nonempty, distinct source edit intent with a new version and notify the shell.
void handleMultiLineTab (UndoState &state, bool shift)
 Indent or outdent selected lines and update the undo state.
void updateChangeTracking ()
 Mark the cursor line changed when scrollbar markers are enabled.

Public Attributes

std::function< void()> ensureCursorVisibleHook
 Ask the shell to scroll the current cursor into view.
std::function< void()> requestAutocompleteHook
 Ask the shell to update autocomplete suggestions.
std::function< void(char32_t, const Coordinates &)> functionTooltipHook
 Notify the shell of a character that may open a function tooltip.
std::function< void()> onContentUpdateInternal
 Notify the shell that editable content changed.
std::function< void(const SourceEditIntent &)> sourceEditIntentHook
 Notify the shell when a byte-level source edit intent is queued.

Detailed Description

Headless editing substrate - the text buffer, cursor, undo history and syntax colorizer with no ImGui dependency.

TextEditor wraps this class with ImGui rendering and input. Headless consumers can construct this core directly.

Member Typedef Documentation

◆ UndoBuffer

Initial value:
std::vector<UndoRecord>

Chronological editing records retained for undo and redo.

Member Function Documentation

◆ addUndo()

void donner::editor::TextEditorCore::addUndo ( UndoRecord & value)

Append an edit to undo history and discard any redo tail.

Parameters
valueEdit record to retain.

◆ advance()

void donner::editor::TextEditorCore::advance ( Coordinates & coordinates) const

Advance a coordinate by one UTF-8 character, crossing lines as needed.

Parameters
coordinatesCoordinate updated in place.

◆ appendSourceEditIntent()

void donner::editor::TextEditorCore::appendSourceEditIntent ( SourceEditIntent intent)

Queue a nonempty, distinct source edit intent with a new version and notify the shell.

Parameters
intentSource edit intent to queue.

◆ applyExternalSourceEdit()

void donner::editor::TextEditorCore::applyExternalSourceEdit ( std::size_t offset,
std::size_t removedLength,
std::string_view replacement )

Apply a source-view update that originated outside the text editor.

This mutates the visible buffer and recolorizes the affected region, but it does not append an undo record, does not create a pending SourceEditIntent, and leaves isTextChanged false. Existing text undo history is cleared, because its records address the previous text. Use this for XML-owned canvas writebacks that are being mirrored into the source pane.

Parameters
offsetByte offset in the current buffer.
removedLengthNumber of bytes to remove at offset.
replacementReplacement bytes to insert at offset.

◆ colorize()

void donner::editor::TextEditorCore::colorize ( int fromLine = 0,
int count = -1 )

Schedule syntax coloring for a line range.

Parameters
fromLineFirst line to recolor.
countNumber of lines, or -1 for the remainder.

◆ colorizeRange()

void donner::editor::TextEditorCore::colorizeRange ( int fromLine = 0,
int toLine = 0 )

Recolor the half-open line range [fromLine, toLine).

Parameters
fromLineFirst line in the range.
toLineFirst line after the range.

◆ deleteRange()

void donner::editor::TextEditorCore::deleteRange ( const Coordinates & start,
const Coordinates & end )

Delete the text between two coordinates.

Parameters
startFirst coordinate to delete.
endCoordinate after the deleted range.

◆ enterCharacter()

void donner::editor::TextEditorCore::enterCharacter ( char32_t character,
bool shift )

Insert one character at the cursor or replace the selection.

Parameters
characterUnicode scalar to insert.
shiftWhether Shift is held for indentation behavior.

◆ findFirst()

Coordinates donner::editor::TextEditorCore::findFirst ( std::string_view searchText,
const Coordinates & start ) const

Find the first whole-word match at or after a coordinate.

Parameters
searchTextWord to find.
startCoordinate where the search begins.
Returns
Match location, or (total line count, 0) when none exists.

◆ findNextWord()

Coordinates donner::editor::TextEditorCore::findNextWord ( const Coordinates & from) const

Find the next word boundary after a coordinate.

Parameters
fromCoordinate where the search begins.

◆ findWordEnd()

Coordinates donner::editor::TextEditorCore::findWordEnd ( const Coordinates & from) const

Find the end of the word containing or following a coordinate.

Parameters
fromCoordinate used to locate the word.

◆ findWordStart()

Coordinates donner::editor::TextEditorCore::findWordStart ( const Coordinates & from) const

Find the start of the word containing or preceding a coordinate.

Parameters
fromCoordinate used to locate the word.

◆ getCoordinatesAtByteOffset()

Coordinates donner::editor::TextEditorCore::getCoordinatesAtByteOffset ( std::size_t offset) const
inline

Resolve a full-buffer byte offset to editor coordinates.

Parameters
offsetByte offset in getText().

◆ getGlyphColor()

unsigned int donner::editor::TextEditorCore::getGlyphColor ( const Glyph & glyph) const

Return the active palette color for a glyph and its comment state.

Parameters
glyphGlyph whose syntax color is requested.

◆ getText()

std::string donner::editor::TextEditorCore::getText ( const Coordinates & start,
const Coordinates & end ) const

Return the text in the half-open coordinate range.

Parameters
startFirst coordinate to read.
endCoordinate after the last character to read.

◆ getWordAt()

RcString donner::editor::TextEditorCore::getWordAt ( const Coordinates & coords) const

Return the word containing a coordinate.

Parameters
coordsCoordinate within the word.

◆ handleEndOfLineDelete()

void donner::editor::TextEditorCore::handleEndOfLineDelete ( Coordinates pos,
UndoRecord & undo )

Delete the line break at the end of a line and record the edit.

Parameters
posDeletion coordinate.
undoUndo record updated with the removed text.

◆ handleMidLineBackspace()

void donner::editor::TextEditorCore::handleMidLineBackspace ( const Coordinates & pos,
UndoRecord & undo )

Backspace within a line and record the edit.

Parameters
posCursor coordinate.
undoUndo record updated with the removed text.

◆ handleMidLineDelete()

void donner::editor::TextEditorCore::handleMidLineDelete ( Coordinates pos,
UndoRecord & undo )

Delete a character within a line and record the edit.

Parameters
posDeletion coordinate.
undoUndo record updated with the removed text.

◆ handleMultiLineTab()

void donner::editor::TextEditorCore::handleMultiLineTab ( UndoState & state,
bool shift )

Indent or outdent selected lines and update the undo state.

Parameters
stateUndo state accumulated for the operation.
shiftTrue to outdent instead of indenting.

◆ handleNewLine()

void donner::editor::TextEditorCore::handleNewLine ( UndoState & state,
const Coordinates & coord,
bool smartIndent )

Insert a newline and record its undo state and indentation.

Parameters
stateUndo state accumulated for this insertion.
coordInsertion coordinate.
smartIndentWhether context-sensitive indentation is enabled.

◆ handleRegularCharacter()

void donner::editor::TextEditorCore::handleRegularCharacter ( UndoState & state,
const Coordinates & coord,
char32_t character )

Insert a regular character and update its undo state.

Parameters
stateUndo state accumulated for this insertion.
coordInsertion coordinate.
characterCharacter to insert.

◆ handleStartOfLineDelete()

void donner::editor::TextEditorCore::handleStartOfLineDelete ( const Coordinates & pos,
UndoRecord & undo )

Delete at the start of a line and record the edit.

Parameters
posDeletion coordinate.
undoUndo record updated with the removed text.

◆ insertLine()

Line & donner::editor::TextEditorCore::insertLine ( int index,
int column )

Insert a blank line at index, or split the line at index when column is nonzero. Fold and error-marker positions are updated after insertion.

Parameters
indexBlank-line insertion index, or existing line to split.
columnSplit column when index names an existing line; otherwise insert a blank line.
Returns
Inserted blank line at index, or split suffix at index + 1.

◆ insertText()

void donner::editor::TextEditorCore::insertText ( std::string_view text,
bool indent = false )

Insert text at the cursor, optionally applying indentation.

Parameters
textText to insert.
indentWhether to apply indentation to inserted lines.

◆ insertTextAt()

int donner::editor::TextEditorCore::insertTextAt ( Coordinates & where,
std::string_view text,
bool indent = false )

Insert text at a coordinate and update that coordinate as lines are added.

Parameters
whereInsertion point, updated to the end of the inserted text.
textText to insert.
indentWhether to apply indentation to inserted lines.

◆ isOnWordBoundary()

bool donner::editor::TextEditorCore::isOnWordBoundary ( const Coordinates & at) const

Report whether a coordinate lies on a word boundary.

Parameters
atCoordinate to inspect.

◆ moveBottom()

void donner::editor::TextEditorCore::moveBottom ( bool select = false)

Move the cursor to the end of the final line.

Parameters
selectWhether to extend the selection.

◆ moveCursorTo()

void donner::editor::TextEditorCore::moveCursorTo ( const Coordinates & position,
bool select )

Move the cursor to position. With select the selection extends from its anchor, the end the cursor did not occupy; otherwise it collapses to the cursor.

Parameters
positionNew cursor position.
selectWhether to extend the selection.

◆ moveDown()

void donner::editor::TextEditorCore::moveDown ( int amount = 1,
bool select = false )

Move the cursor down by logical lines.

Parameters
amountNumber of lines to move.
selectWhether to extend the selection.

◆ moveEnd()

void donner::editor::TextEditorCore::moveEnd ( bool select = false)

Move the cursor to the end of its current line.

Parameters
selectWhether to extend the selection.

◆ moveHome()

void donner::editor::TextEditorCore::moveHome ( bool select = false)

Move the cursor to the start of its current line.

Parameters
selectWhether to extend the selection.

◆ moveLeft()

void donner::editor::TextEditorCore::moveLeft ( int amount = 1,
bool select = false,
bool wordMode = false )

Move the cursor left by characters or words.

Parameters
amountNumber of steps to move.
selectWhether to extend the selection.
wordModeWhether each step moves to the start of the current or previous word, continuing onto earlier lines.

◆ moveRight()

void donner::editor::TextEditorCore::moveRight ( int amount = 1,
bool select = false,
bool wordMode = false )

Move the cursor right by characters or words.

Parameters
amountNumber of steps to move.
selectWhether to extend the selection.
wordModeWhether each step moves to the end of the current or next word, continuing onto later lines.

◆ moveTop()

void donner::editor::TextEditorCore::moveTop ( bool select = false)

Move the cursor to the start of the buffer.

Parameters
selectWhether to extend the selection.

◆ moveUp()

void donner::editor::TextEditorCore::moveUp ( int amount = 1,
bool select = false )

Move the cursor up by logical lines.

Parameters
amountNumber of lines to move.
selectWhether to extend the selection.

◆ recordSourceEditIntent()

void donner::editor::TextEditorCore::recordSourceEditIntent ( const UndoRecord & record,
SourceEditIntentKind kind )

Convert an undo record into a byte-level source edit intent.

Parameters
recordEdit whose text and bounds are translated.
kindWhether the source intent applies or reverses the edit.

◆ redo()

void donner::editor::TextEditorCore::redo ( int steps = 1)

Redo the requested number of edits.

Parameters
stepsMaximum number of edits to redo.

◆ removeFolds() [1/2]

void donner::editor::TextEditorCore::removeFolds ( const Coordinates & start,
const Coordinates & end )

Remove fold markers in a coordinate range.

Parameters
startFirst coordinate in the range.
endLast coordinate in the range.

◆ removeFolds() [2/2]

void donner::editor::TextEditorCore::removeFolds ( std::vector< Coordinates > & folds,
const Coordinates & start,
const Coordinates & end )

Remove fold markers from one marker array in a coordinate range.

Parameters
foldsMarker array to update.
startFirst coordinate in the range.
endLast coordinate in the range.

◆ removeLine() [1/2]

void donner::editor::TextEditorCore::removeLine ( int index)

Remove one line and update fold, marker, and change positions.

Parameters
indexLine to remove.

◆ removeLine() [2/2]

void donner::editor::TextEditorCore::removeLine ( int start,
int end )

Remove an inclusive range of lines and update error and changed-line markers.

Parameters
startFirst line to remove.
endLast line to remove.

◆ sanitizeCoordinates()

Coordinates donner::editor::TextEditorCore::sanitizeCoordinates ( const Coordinates & value) const

Clamp a coordinate to an existing line and column.

Parameters
valueCoordinate to sanitize.

◆ setActiveAutocomplete()

void donner::editor::TextEditorCore::setActiveAutocomplete ( bool value)
inline

Enable or disable active autocomplete requests.

Parameters
valueWhether autocomplete is active.

◆ setAutoIndentOnPaste()

void donner::editor::TextEditorCore::setAutoIndentOnPaste ( bool value)
inline

Enable or disable indentation of pasted lines.

Parameters
valueWhether pasted lines are auto-indented.

◆ setColorizerEnabled()

void donner::editor::TextEditorCore::setColorizerEnabled ( bool enabled)
inline

Enable or disable syntax coloring.

Parameters
enabledWhether to colorize tokens.

◆ setCompleteBraces()

void donner::editor::TextEditorCore::setCompleteBraces ( bool value)
inline

Enable or disable automatic closing-brace insertion.

Parameters
valueWhether matching braces are completed.

◆ setCursorPosition()

void donner::editor::TextEditorCore::setCursorPosition ( const Coordinates & position)

Store a requested cursor position; reads clamp it to the current buffer.

Parameters
positionRequested cursor position.

◆ setCursorPositionChanged()

void donner::editor::TextEditorCore::setCursorPositionChanged ( bool value)
inline

Set the cursor-position-change flag.

Parameters
valueWhether the cursor has moved.

◆ setErrorMarkers()

void donner::editor::TextEditorCore::setErrorMarkers ( const ErrorMarkers & markers)
inline

Replace the line-numbered diagnostic markers.

Parameters
markersMarkers to display.

◆ setInsertSpaces()

void donner::editor::TextEditorCore::setInsertSpaces ( bool value)
inline

Choose whether indentation inserts spaces rather than tabs.

Parameters
valueTrue to insert spaces.

◆ setLanguageDefinition()

void donner::editor::TextEditorCore::setLanguageDefinition ( const LanguageDefinition & langDef)

Set the syntax rules and schedule the buffer for recoloring.

Parameters
langDefLanguage definition to use.

◆ setPalette()

void donner::editor::TextEditorCore::setPalette ( const Palette & value)
inline

Set the base color palette used by the text editor.

Parameters
valuePalette to store.

◆ setReplaceIndex()

void donner::editor::TextEditorCore::setReplaceIndex ( int index)
inline

Set the replacement index used by the text shell.

Parameters
indexReplacement index to store.

◆ setScrollbarMarkers()

void donner::editor::TextEditorCore::setScrollbarMarkers ( bool value)
inline

Show or hide changed-line markers in the scrollbar.

Parameters
valueWhether markers are shown.

◆ setSelection()

void donner::editor::TextEditorCore::setSelection ( const Coordinates & start,
const Coordinates & end,
SelectionMode mode = SelectionMode::Normal )

Select between two endpoints, storing ordered bounds and expanding words or lines.

Parameters
startFirst requested endpoint.
endSecond requested endpoint.
modeBoundary expansion mode.

◆ setSelectionEnd()

void donner::editor::TextEditorCore::setSelectionEnd ( const Coordinates & position)

Replace the ordered upper selection bound, swapping bounds if needed.

Parameters
positionRequested upper bound.

◆ setSelectionMode()

void donner::editor::TextEditorCore::setSelectionMode ( SelectionMode mode)
inline

Set how selection boundaries are expanded.

Parameters
modeSelection mode to use.

◆ setSelectionStart()

void donner::editor::TextEditorCore::setSelectionStart ( const Coordinates & position)

Replace the ordered lower selection bound, swapping bounds if needed.

Parameters
positionRequested lower bound.

◆ setSmartIndent()

void donner::editor::TextEditorCore::setSmartIndent ( bool value)
inline

Enable or disable context-sensitive indentation.

Parameters
valueWhether smart indentation is active.

◆ setTabSize()

void donner::editor::TextEditorCore::setTabSize ( int size)

Set the number of columns represented by one tab, clamped to 0 through 32.

Parameters
sizeRequested tab width.

◆ undo()

void donner::editor::TextEditorCore::undo ( int steps = 1)

Undo the requested number of edits.

Parameters
stepsMaximum number of edits to undo.

The documentation for this class was generated from the following file: