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. | |
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.
Chronological editing records retained for undo and redo.
| void donner::editor::TextEditorCore::addUndo | ( | UndoRecord & | value | ) |
Append an edit to undo history and discard any redo tail.
| value | Edit record to retain. |
| void donner::editor::TextEditorCore::advance | ( | Coordinates & | coordinates | ) | const |
Advance a coordinate by one UTF-8 character, crossing lines as needed.
| coordinates | Coordinate updated in place. |
| void donner::editor::TextEditorCore::appendSourceEditIntent | ( | SourceEditIntent | intent | ) |
Queue a nonempty, distinct source edit intent with a new version and notify the shell.
| intent | Source edit intent to queue. |
| 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.
| offset | Byte offset in the current buffer. |
| removedLength | Number of bytes to remove at offset. |
| replacement | Replacement bytes to insert at offset. |
| void donner::editor::TextEditorCore::colorize | ( | int | fromLine = 0, |
| int | count = -1 ) |
Schedule syntax coloring for a line range.
| fromLine | First line to recolor. |
| count | Number of lines, or -1 for the remainder. |
| void donner::editor::TextEditorCore::colorizeRange | ( | int | fromLine = 0, |
| int | toLine = 0 ) |
Recolor the half-open line range [fromLine, toLine).
| fromLine | First line in the range. |
| toLine | First line after the range. |
| void donner::editor::TextEditorCore::deleteRange | ( | const Coordinates & | start, |
| const Coordinates & | end ) |
Delete the text between two coordinates.
| start | First coordinate to delete. |
| end | Coordinate after the deleted range. |
| void donner::editor::TextEditorCore::enterCharacter | ( | char32_t | character, |
| bool | shift ) |
Insert one character at the cursor or replace the selection.
| character | Unicode scalar to insert. |
| shift | Whether Shift is held for indentation behavior. |
| Coordinates donner::editor::TextEditorCore::findFirst | ( | std::string_view | searchText, |
| const Coordinates & | start ) const |
Find the first whole-word match at or after a coordinate.
| searchText | Word to find. |
| start | Coordinate where the search begins. |
| Coordinates donner::editor::TextEditorCore::findNextWord | ( | const Coordinates & | from | ) | const |
Find the next word boundary after a coordinate.
| from | Coordinate where the search begins. |
| Coordinates donner::editor::TextEditorCore::findWordEnd | ( | const Coordinates & | from | ) | const |
Find the end of the word containing or following a coordinate.
| from | Coordinate used to locate the word. |
| Coordinates donner::editor::TextEditorCore::findWordStart | ( | const Coordinates & | from | ) | const |
Find the start of the word containing or preceding a coordinate.
| from | Coordinate used to locate the word. |
|
inline |
Resolve a full-buffer byte offset to editor coordinates.
| offset | Byte offset in getText(). |
| unsigned int donner::editor::TextEditorCore::getGlyphColor | ( | const Glyph & | glyph | ) | const |
Return the active palette color for a glyph and its comment state.
| glyph | Glyph whose syntax color is requested. |
| std::string donner::editor::TextEditorCore::getText | ( | const Coordinates & | start, |
| const Coordinates & | end ) const |
Return the text in the half-open coordinate range.
| start | First coordinate to read. |
| end | Coordinate after the last character to read. |
| RcString donner::editor::TextEditorCore::getWordAt | ( | const Coordinates & | coords | ) | const |
Return the word containing a coordinate.
| coords | Coordinate within the word. |
| void donner::editor::TextEditorCore::handleEndOfLineDelete | ( | Coordinates | pos, |
| UndoRecord & | undo ) |
Delete the line break at the end of a line and record the edit.
| pos | Deletion coordinate. |
| undo | Undo record updated with the removed text. |
| void donner::editor::TextEditorCore::handleMidLineBackspace | ( | const Coordinates & | pos, |
| UndoRecord & | undo ) |
Backspace within a line and record the edit.
| pos | Cursor coordinate. |
| undo | Undo record updated with the removed text. |
| void donner::editor::TextEditorCore::handleMidLineDelete | ( | Coordinates | pos, |
| UndoRecord & | undo ) |
Delete a character within a line and record the edit.
| pos | Deletion coordinate. |
| undo | Undo record updated with the removed text. |
| void donner::editor::TextEditorCore::handleMultiLineTab | ( | UndoState & | state, |
| bool | shift ) |
Indent or outdent selected lines and update the undo state.
| state | Undo state accumulated for the operation. |
| shift | True to outdent instead of indenting. |
| void donner::editor::TextEditorCore::handleNewLine | ( | UndoState & | state, |
| const Coordinates & | coord, | ||
| bool | smartIndent ) |
Insert a newline and record its undo state and indentation.
| state | Undo state accumulated for this insertion. |
| coord | Insertion coordinate. |
| smartIndent | Whether context-sensitive indentation is enabled. |
| void donner::editor::TextEditorCore::handleRegularCharacter | ( | UndoState & | state, |
| const Coordinates & | coord, | ||
| char32_t | character ) |
Insert a regular character and update its undo state.
| state | Undo state accumulated for this insertion. |
| coord | Insertion coordinate. |
| character | Character to insert. |
| void donner::editor::TextEditorCore::handleStartOfLineDelete | ( | const Coordinates & | pos, |
| UndoRecord & | undo ) |
Delete at the start of a line and record the edit.
| pos | Deletion coordinate. |
| undo | Undo record updated with the removed text. |
| 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.
| index | Blank-line insertion index, or existing line to split. |
| column | Split column when index names an existing line; otherwise insert a blank line. |
| void donner::editor::TextEditorCore::insertText | ( | std::string_view | text, |
| bool | indent = false ) |
Insert text at the cursor, optionally applying indentation.
| text | Text to insert. |
| indent | Whether to apply indentation to inserted lines. |
| 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.
| where | Insertion point, updated to the end of the inserted text. |
| text | Text to insert. |
| indent | Whether to apply indentation to inserted lines. |
| bool donner::editor::TextEditorCore::isOnWordBoundary | ( | const Coordinates & | at | ) | const |
Report whether a coordinate lies on a word boundary.
| at | Coordinate to inspect. |
| void donner::editor::TextEditorCore::moveBottom | ( | bool | select = false | ) |
Move the cursor to the end of the final line.
| select | Whether to extend the selection. |
| 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.
| position | New cursor position. |
| select | Whether to extend the selection. |
| void donner::editor::TextEditorCore::moveDown | ( | int | amount = 1, |
| bool | select = false ) |
Move the cursor down by logical lines.
| amount | Number of lines to move. |
| select | Whether to extend the selection. |
| void donner::editor::TextEditorCore::moveEnd | ( | bool | select = false | ) |
Move the cursor to the end of its current line.
| select | Whether to extend the selection. |
| void donner::editor::TextEditorCore::moveHome | ( | bool | select = false | ) |
Move the cursor to the start of its current line.
| select | Whether to extend the selection. |
| void donner::editor::TextEditorCore::moveLeft | ( | int | amount = 1, |
| bool | select = false, | ||
| bool | wordMode = false ) |
Move the cursor left by characters or words.
| amount | Number of steps to move. |
| select | Whether to extend the selection. |
| wordMode | Whether each step moves to the start of the current or previous word, continuing onto earlier lines. |
| void donner::editor::TextEditorCore::moveRight | ( | int | amount = 1, |
| bool | select = false, | ||
| bool | wordMode = false ) |
Move the cursor right by characters or words.
| amount | Number of steps to move. |
| select | Whether to extend the selection. |
| wordMode | Whether each step moves to the end of the current or next word, continuing onto later lines. |
| void donner::editor::TextEditorCore::moveTop | ( | bool | select = false | ) |
Move the cursor to the start of the buffer.
| select | Whether to extend the selection. |
| void donner::editor::TextEditorCore::moveUp | ( | int | amount = 1, |
| bool | select = false ) |
Move the cursor up by logical lines.
| amount | Number of lines to move. |
| select | Whether to extend the selection. |
| void donner::editor::TextEditorCore::recordSourceEditIntent | ( | const UndoRecord & | record, |
| SourceEditIntentKind | kind ) |
Convert an undo record into a byte-level source edit intent.
| record | Edit whose text and bounds are translated. |
| kind | Whether the source intent applies or reverses the edit. |
| void donner::editor::TextEditorCore::redo | ( | int | steps = 1 | ) |
Redo the requested number of edits.
| steps | Maximum number of edits to redo. |
| void donner::editor::TextEditorCore::removeFolds | ( | const Coordinates & | start, |
| const Coordinates & | end ) |
Remove fold markers in a coordinate range.
| start | First coordinate in the range. |
| end | Last coordinate in the range. |
| 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.
| folds | Marker array to update. |
| start | First coordinate in the range. |
| end | Last coordinate in the range. |
| void donner::editor::TextEditorCore::removeLine | ( | int | index | ) |
Remove one line and update fold, marker, and change positions.
| index | Line to remove. |
| void donner::editor::TextEditorCore::removeLine | ( | int | start, |
| int | end ) |
Remove an inclusive range of lines and update error and changed-line markers.
| start | First line to remove. |
| end | Last line to remove. |
| Coordinates donner::editor::TextEditorCore::sanitizeCoordinates | ( | const Coordinates & | value | ) | const |
Clamp a coordinate to an existing line and column.
| value | Coordinate to sanitize. |
|
inline |
Enable or disable active autocomplete requests.
| value | Whether autocomplete is active. |
|
inline |
Enable or disable indentation of pasted lines.
| value | Whether pasted lines are auto-indented. |
|
inline |
Enable or disable syntax coloring.
| enabled | Whether to colorize tokens. |
|
inline |
Enable or disable automatic closing-brace insertion.
| value | Whether matching braces are completed. |
| void donner::editor::TextEditorCore::setCursorPosition | ( | const Coordinates & | position | ) |
Store a requested cursor position; reads clamp it to the current buffer.
| position | Requested cursor position. |
|
inline |
Set the cursor-position-change flag.
| value | Whether the cursor has moved. |
|
inline |
Replace the line-numbered diagnostic markers.
| markers | Markers to display. |
|
inline |
Choose whether indentation inserts spaces rather than tabs.
| value | True to insert spaces. |
| void donner::editor::TextEditorCore::setLanguageDefinition | ( | const LanguageDefinition & | langDef | ) |
Set the syntax rules and schedule the buffer for recoloring.
| langDef | Language definition to use. |
|
inline |
Set the base color palette used by the text editor.
| value | Palette to store. |
|
inline |
Set the replacement index used by the text shell.
| index | Replacement index to store. |
|
inline |
Show or hide changed-line markers in the scrollbar.
| value | Whether markers are shown. |
| 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.
| start | First requested endpoint. |
| end | Second requested endpoint. |
| mode | Boundary expansion mode. |
| void donner::editor::TextEditorCore::setSelectionEnd | ( | const Coordinates & | position | ) |
Replace the ordered upper selection bound, swapping bounds if needed.
| position | Requested upper bound. |
|
inline |
Set how selection boundaries are expanded.
| mode | Selection mode to use. |
| void donner::editor::TextEditorCore::setSelectionStart | ( | const Coordinates & | position | ) |
Replace the ordered lower selection bound, swapping bounds if needed.
| position | Requested lower bound. |
|
inline |
Enable or disable context-sensitive indentation.
| value | Whether smart indentation is active. |
| void donner::editor::TextEditorCore::setTabSize | ( | int | size | ) |
Set the number of columns represented by one tab, clamped to 0 through 32.
| size | Requested tab width. |
| void donner::editor::TextEditorCore::undo | ( | int | steps = 1 | ) |
Undo the requested number of edits.
| steps | Maximum number of edits to undo. |