Type Alias: SourceBufferProps
SourceBufferProps =
object
Defined in: nodes/source-buffer.ts:28
Props for the SourceBuffer virtual element.
Used to declaratively configure the text buffer for a GtkSourceView with syntax highlighting, bracket matching, and other source code editing features.
Example
<GtkSourceView>
<x.SourceBuffer
text={sourceCode}
language="typescript"
styleScheme="Adwaita-dark"
highlightSyntax
highlightMatchingBrackets
onTextChanged={(text) => console.log("Code:", text)}
/>
</GtkSourceView>
Properties
enableUndo?
optionalenableUndo:boolean
Defined in: nodes/source-buffer.ts:32
Whether to enable undo/redo
highlightMatchingBrackets?
optionalhighlightMatchingBrackets:boolean
Defined in: nodes/source-buffer.ts:56
Whether to highlight matching brackets when cursor is on a bracket. Defaults to true.
highlightSyntax?
optionalhighlightSyntax:boolean
Defined in: nodes/source-buffer.ts:53
Whether to enable syntax highlighting. Defaults to true when language is set.
implicitTrailingNewline?
optionalimplicitTrailingNewline:boolean
Defined in: nodes/source-buffer.ts:62
Whether the buffer has an implicit trailing newline. When true (default), trailing newlines are handled automatically during file load/save.
language?
optionallanguage:string|GtkSource.Language
Defined in: nodes/source-buffer.ts:44
Language for syntax highlighting. Can be a language ID string (e.g., "typescript", "python", "rust") or a GtkSource.Language object.
onCanRedoChanged()?
optionalonCanRedoChanged: (canRedo) =>void
Defined in: nodes/source-buffer.ts:38
Callback when can-redo state changes
Parameters
| Parameter | Type |
|---|---|
canRedo | boolean |
Returns
void
onCanUndoChanged()?
optionalonCanUndoChanged: (canUndo) =>void
Defined in: nodes/source-buffer.ts:36
Callback when can-undo state changes
Parameters
| Parameter | Type |
|---|---|
canUndo | boolean |
Returns
void
onCursorMoved()?
optionalonCursorMoved: () =>void
Defined in: nodes/source-buffer.ts:65
Callback when the cursor position changes
Returns
void
onHighlightUpdated()?
optionalonHighlightUpdated: (start,end) =>void
Defined in: nodes/source-buffer.ts:68
Callback when syntax highlighting is updated for a region
Parameters
| Parameter | Type |
|---|---|
start | Gtk.TextIter |
end | Gtk.TextIter |
Returns
void
onTextChanged()?
optionalonTextChanged: (text) =>void
Defined in: nodes/source-buffer.ts:34
Callback when the text content changes
Parameters
| Parameter | Type |
|---|---|
text | string |
Returns
void
styleScheme?
optionalstyleScheme:string|GtkSource.StyleScheme
Defined in: nodes/source-buffer.ts:50
Style scheme for syntax highlighting colors. Can be a scheme ID string (e.g., "Adwaita-dark", "classic") or a GtkSource.StyleScheme object.
text?
optionaltext:string
Defined in: nodes/source-buffer.ts:30
Text content