Documentation
¶
Overview ¶
Package sourceview provides a native GOUI code editor. All widget and document operations are sequential and, while mounted, belong on the GUI thread.
Index ¶
- Constants
- Variables
- type Command
- type Completion
- type CompletionContext
- type CompletionProvider
- type Document
- type FindBar
- func (b *FindBar) Close()
- func (b *FindBar) ConnectError(fn func(error)) signal.Handle
- func (b *FindBar) ConnectOpen(fn func(bool)) signal.Handle
- func (b *FindBar) Open(replace bool) error
- func (b *FindBar) Opened() bool
- func (b *FindBar) ReplaceMode() bool
- func (b *FindBar) Replacement() string
- func (b *FindBar) SetReplaceMode(replace bool)
- func (b *FindBar) SetReplacement(text string)
- func (b *FindBar) SetTarget(v *SourceView)
- func (b *FindBar) Snapshot() gui.WidgetInfo
- func (b *FindBar) StyleChanged()
- func (b *FindBar) Target() *SourceView
- type FoldRegion
- type GoToBar
- func (b *GoToBar) Close()
- func (b *GoToBar) ConnectError(fn func(error)) signal.Handle
- func (b *GoToBar) ConnectOpen(fn func(bool)) signal.Handle
- func (b *GoToBar) Open() error
- func (b *GoToBar) Opened() bool
- func (b *GoToBar) Query() string
- func (b *GoToBar) SetQuery(text string)
- func (b *GoToBar) SetTarget(v *SourceView)
- func (b *GoToBar) Snapshot() gui.WidgetInfo
- func (b *GoToBar) Target() *SourceView
- type IndentOptions
- type KeyBindings
- type SearchQuery
- type SourceView
- func (v *SourceView) AcceptsTab() bool
- func (v *SourceView) ApplyEdits(document *Document, revision uint64, edits []textedit.Edit, ...) error
- func (v *SourceView) Arrange(rect geometry.Rectangle)
- func (v *SourceView) AutoPairs() bool
- func (v *SourceView) AutomaticCompletion() bool
- func (v *SourceView) ConnectChange(fn func(textedit.Change)) signal.Handle
- func (v *SourceView) ConnectError(fn func(error)) signal.Handle
- func (v *SourceView) ConnectFoldingChanged(fn func()) signal.Handle
- func (v *SourceView) ConnectScrollIntoView(fn func(geometry.Rectangle)) signal.Handle
- func (v *SourceView) ConnectSelection(fn func(textedit.Selection)) signal.Handle
- func (v *SourceView) ContentSize() geometry.Size
- func (v *SourceView) Copy() error
- func (v *SourceView) Cut() error
- func (v *SourceView) DeleteLines() error
- func (v *SourceView) DeleteWord(forward bool) error
- func (v *SourceView) Document() *Document
- func (v *SourceView) DuplicateLines(down bool) error
- func (v *SourceView) FindNext(backward bool) (textedit.Range, bool)
- func (v *SourceView) Fold(line int) bool
- func (v *SourceView) FoldAll()
- func (v *SourceView) FoldingEnabled() bool
- func (v *SourceView) FoldingRegions() []FoldRegion
- func (v *SourceView) HighlightOccurrences() bool
- func (v *SourceView) HighlightSearchMatches() bool
- func (v *SourceView) IMContext() gui.IMContext
- func (v *SourceView) Indent(outdent bool) error
- func (v *SourceView) IndentOptions() IndentOptions
- func (v *SourceView) InsertLine(below bool) error
- func (v *SourceView) JumpToBracket() bool
- func (v *SourceView) KeyBindings() KeyBindings
- func (v *SourceView) LayoutVisible(viewport geometry.Size, offset geometry.Point)
- func (v *SourceView) LinkedTags() bool
- func (v *SourceView) Measure(c layout.Constraint) layout.Measurement
- func (v *SourceView) MoveLines(down bool) error
- func (v *SourceView) MoveWord(forward, extend bool)
- func (v *SourceView) Paint(p gui.Painter)
- func (v *SourceView) Paste() error
- func (v *SourceView) ReadOnly() bool
- func (v *SourceView) Redo() bool
- func (v *SourceView) ReplaceAll(text string) (int, error)
- func (v *SourceView) ReplaceCurrent(text string) (bool, error)
- func (v *SourceView) ReplaceSelection(text string) error
- func (v *SourceView) RevealSelection()
- func (v *SourceView) Rulers() []int
- func (v *SourceView) Search() SearchQuery
- func (v *SourceView) SearchError() error
- func (v *SourceView) SearchRange() (textedit.Range, bool)
- func (v *SourceView) SelectLine()
- func (v *SourceView) Selection() textedit.Selection
- func (v *SourceView) SetAcceptsTab(value bool)
- func (v *SourceView) SetAutoPairs(enabled bool)
- func (v *SourceView) SetAutomaticCompletion(enabled bool)
- func (v *SourceView) SetCompletionProvider(provider *CompletionProvider)
- func (v *SourceView) SetDocument(d *Document)
- func (v *SourceView) SetFoldingEnabled(enabled bool)
- func (v *SourceView) SetHighlightOccurrences(b bool)
- func (v *SourceView) SetHighlightSearchMatches(highlight bool)
- func (v *SourceView) SetIndentOptions(o IndentOptions) error
- func (v *SourceView) SetKeyBindings(bindings KeyBindings) error
- func (v *SourceView) SetLinkedTags(b bool)
- func (v *SourceView) SetReadOnly(value bool)
- func (v *SourceView) SetRulers(columns []int) error
- func (v *SourceView) SetScheme(s *scheme.Scheme)
- func (v *SourceView) SetSearch(q SearchQuery)
- func (v *SourceView) SetSearchRange(r *textedit.Range) error
- func (v *SourceView) SetSelection(s textedit.Selection)
- func (v *SourceView) SetShowIndentGuides(b bool)
- func (v *SourceView) SetShowLineEndings(b bool)
- func (v *SourceView) SetShowLineNumbers(show bool)
- func (v *SourceView) SetSmartBackspace(b bool)
- func (v *SourceView) SetSmartHomeEnd(b bool)
- func (v *SourceView) SetWhitespaceMode(mode WhitespaceMode) error
- func (v *SourceView) SetWrapMode(w WrapMode)
- func (v *SourceView) ShowCompletion() error
- func (v *SourceView) ShowIndentGuides() bool
- func (v *SourceView) ShowLineEndings() bool
- func (v *SourceView) ShowLineNumbers() bool
- func (v *SourceView) SmartBackspace() bool
- func (v *SourceView) SmartHomeEnd() bool
- func (v *SourceView) Snapshot() gui.WidgetInfo
- func (v *SourceView) StyleChanged()
- func (v *SourceView) ToggleBlockComment() error
- func (v *SourceView) ToggleFold(line int) bool
- func (v *SourceView) ToggleLineComment() error
- func (v *SourceView) Undo() bool
- func (v *SourceView) Unfold(line int) bool
- func (v *SourceView) UnfoldAll()
- func (v *SourceView) WhitespaceMode() WhitespaceMode
- func (v *SourceView) WrapMode() WrapMode
- type WhitespaceMode
- type WrapMode
Constants ¶
const ( WrapNone = typography.WrapNone WrapChar = typography.WrapChar WrapWordChar = typography.WrapWordChar )
Variables ¶
var ( ErrReadOnly = errors.New("sourceview: read only") ErrDisabled = errors.New("sourceview: disabled") ErrNotMounted = errors.New("sourceview: not mounted") ErrUnknownLanguage = errors.New("sourceview: unknown language") ErrOperationLimit = editor.ErrOperationLimit ErrOperationChanged = errors.New("sourceview: operation context changed") )
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command uint16
Command identifies an editor operation, not a global command registration. Zero and unknown values are invalid. Bindings do not change an operation's editing, focus, preedit or lifecycle requirements.
const ( CommandUndo Command = iota + 1 CommandRedo CommandCut CommandCopy CommandPaste CommandDeleteSelection CommandMoveLinesUp CommandMoveLinesDown CommandDuplicateLinesUp CommandDuplicateLinesDown CommandDeleteLines CommandSelectAll CommandFold CommandUnfold CommandFoldAll CommandUnfoldAll CommandComplete CommandToggleLineComment CommandToggleBlockComment CommandIndent CommandOutdent CommandInsertLineAbove CommandInsertLineBelow CommandSelectLine CommandJumpToBracket CommandMoveWordLeft CommandMoveWordRight CommandSelectWordLeft CommandSelectWordRight CommandDeleteWordLeft CommandDeleteWordRight CommandMoveLineStart CommandMoveLineEnd CommandSelectLineStart CommandSelectLineEnd CommandMoveDocumentStart CommandMoveDocumentEnd CommandSelectDocumentStart CommandSelectDocumentEnd CommandFindNext CommandFindPrevious // Find/Replace/GoTo are handled only by an attached companion bar. CommandFind CommandReplace CommandGoTo )
type Completion ¶
type Completion struct {
Label, Text, Detail string
Range *textedit.Range
AdditionalEdits []textedit.Edit
Caret *int
}
Completion is a literal edit. Nil Range uses the requested word range. Empty Text uses Label. Caret, when set, is a UTF-8 offset relative to inserted Text. AdditionalEdits use the same original document coordinates as the primary edit.
func DefaultCompletions ¶
func DefaultCompletions(c CompletionContext) []Completion
DefaultCompletions explicitly combines language suggestions and nearby words, with case-insensitive prefix filtering, de-duplication and alphabetical order.
func DocumentCompletions ¶
func DocumentCompletions(c CompletionContext) []Completion
DocumentCompletions returns whole words from the bounded nearby snapshot.
func LanguageCompletions ¶
func LanguageCompletions(c CompletionContext) []Completion
LanguageCompletions returns the definition's static suggestions in code context.
type CompletionContext ¶
type CompletionContext struct {
DocumentID, Revision uint64
Language language.ID
Definition *language.Language
Range textedit.Range
Caret int
Prefix string
Explicit bool
Trigger string
Lexical language.Context
ContextKnown bool
Before, After, NearbyText string
NearbyOffset, DocumentLength int
}
CompletionContext is an immutable, bounded snapshot, safe on a worker. It has no live Model, Document or Widget. Offsets are UTF-8 bytes. NearbyText has at most 32 KiB on either side; Before/After have at most 16 KiB of the current line. Language/Definition describe the effective language at the caret, including an explicit embedded language. DocumentID remains the outer document identity.
type CompletionProvider ¶
type CompletionProvider struct {
TriggerCharacters string
Complete func(context.Context, CompletionContext) ([]Completion, error)
}
CompletionProvider completely owns candidates, filtering and order. Treat this configuration as immutable; reuse its pointer across declarative updates. Complete runs on one worker per view, must honor cancellation, and must not touch GUI objects. Nil provider selects DefaultCompletions. Empty results stay empty. TriggerCharacters allows automatic requests even with an empty prefix.
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
func NewDocument ¶
func NewDocumentWithModel ¶
func (*Document) LanguageDefinition ¶
LanguageDefinition returns the immutable definition shared by all views.
func (*Document) SetLanguageDefinition ¶
SetLanguageDefinition binds a definition directly. Nil selects plain text. Identity matters: a different definition with the same ID invalidates analysis.
type FindBar ¶
type FindBar struct {
gui.WidgetBase
// contains filtered or unexported fields
}
FindBar is an optional companion widget. Usually mount it as an Overlay above the editor viewport in the same Root, then SetTarget. It owns its controls, not the editor or document. Its content is initially closed; the application chooses its placement.
func NewFindBar ¶
func NewFindBar() *FindBar
func (*FindBar) Close ¶
func (b *FindBar) Close()
Close hides search backgrounds and clears the search scope, retaining the query for reopening and next/previous navigation. It returns focus only when focus was inside the bar, preserving ordinary text selection.
func (*FindBar) Open ¶
Open focuses the query, seeding it from a short single-line selection when invoked from the editor. It never replaces a multiline selection with spaces.
func (*FindBar) ReplaceMode ¶
func (*FindBar) Replacement ¶
func (*FindBar) SetReplaceMode ¶
func (*FindBar) SetReplacement ¶
func (*FindBar) SetTarget ¶
func (b *FindBar) SetTarget(v *SourceView)
SetTarget borrows an editor. nil detaches it. Only a mounted editor in the same Root gets bindings; replacing/unmounting the bar releases those bindings.
func (*FindBar) Snapshot ¶
func (b *FindBar) Snapshot() gui.WidgetInfo
func (*FindBar) StyleChanged ¶
func (b *FindBar) StyleChanged()
func (*FindBar) Target ¶
func (b *FindBar) Target() *SourceView
type FoldRegion ¶
FoldRegion is a detached snapshot. Lines are zero-based and EndLine inclusive.
type GoToBar ¶
type GoToBar struct {
gui.WidgetBase
// contains filtered or unexported fields
}
GoToBar is an optional floating line/column input. Mount it in an Overlay in the editor's Root. It borrows its target and does not own document state.
func NewGoToBar ¶
func NewGoToBar() *GoToBar
func (*GoToBar) SetTarget ¶
func (b *GoToBar) SetTarget(v *SourceView)
func (*GoToBar) Snapshot ¶
func (b *GoToBar) Snapshot() gui.WidgetInfo
func (*GoToBar) Target ¶
func (b *GoToBar) Target() *SourceView
type IndentOptions ¶
type KeyBindings ¶
type KeyBindings map[Command][]gui.KeyGesture
KeyBindings maps editor commands to alternative single-key gestures. It covers command shortcuts, not text commits or transient popup navigation.
func DefaultKeyBindings ¶
func DefaultKeyBindings() KeyBindings
DefaultKeyBindings returns a fresh, editable table for the current platform. Explicit completion has no default gesture; applications may bind it.
type SearchQuery ¶
type SourceView ¶
type SourceView struct {
gui.WidgetBase
// contains filtered or unexported fields
}
SourceView is an independent editable leaf. Put it in gui.ScrollView to add scrollbars; set that host's StyleName to "source-view" for a shared outer frame. Construction owns no model/settings/root subscriptions.
func NewSourceView ¶
func NewSourceView() *SourceView
func (*SourceView) AcceptsTab ¶
func (v *SourceView) AcceptsTab() bool
func (*SourceView) ApplyEdits ¶
func (v *SourceView) ApplyEdits(document *Document, revision uint64, edits []textedit.Edit, after textedit.Selection) error
ApplyEdits applies original-coordinate edits as one undo unit, with an explicit post-edit selection. Document identity and revision must match. All ranges and the selection are validated before mutation by textedit.
func (*SourceView) Arrange ¶
func (v *SourceView) Arrange(rect geometry.Rectangle)
func (*SourceView) AutoPairs ¶
func (v *SourceView) AutoPairs() bool
AutoPairs controls insertion, surrounding and deletion of generated pairs. It does not affect explicit ReplaceSelection, paste or composed IME commits.
func (*SourceView) AutomaticCompletion ¶
func (v *SourceView) AutomaticCompletion() bool
func (*SourceView) ConnectChange ¶
func (v *SourceView) ConnectChange(fn func(textedit.Change)) signal.Handle
func (*SourceView) ConnectError ¶
func (v *SourceView) ConnectError(fn func(error)) signal.Handle
func (*SourceView) ConnectFoldingChanged ¶
func (v *SourceView) ConnectFoldingChanged(fn func()) signal.Handle
func (*SourceView) ConnectScrollIntoView ¶
func (v *SourceView) ConnectScrollIntoView(fn func(geometry.Rectangle)) signal.Handle
func (*SourceView) ConnectSelection ¶
func (v *SourceView) ConnectSelection(fn func(textedit.Selection)) signal.Handle
func (*SourceView) ContentSize ¶
func (v *SourceView) ContentSize() geometry.Size
func (*SourceView) Copy ¶
func (v *SourceView) Copy() error
func (*SourceView) Cut ¶
func (v *SourceView) Cut() error
func (*SourceView) DeleteLines ¶
func (v *SourceView) DeleteLines() error
DeleteLines deletes the current logical line or selected lines, placing the caret at the deletion boundary. Deleting an empty document is a no-op.
func (*SourceView) DeleteWord ¶
func (v *SourceView) DeleteWord(forward bool) error
DeleteWord deletes the selection, a whitespace run or one code word. Each invocation has its own undo item. At a document edge it is a no-op.
func (*SourceView) Document ¶
func (v *SourceView) Document() *Document
func (*SourceView) DuplicateLines ¶
func (v *SourceView) DuplicateLines(down bool) error
DuplicateLines copies the current logical line or selected lines above/below, retaining the selection in the new copy. The clipboard is not involved.
func (*SourceView) Fold ¶
func (v *SourceView) Fold(line int) bool
func (*SourceView) FoldAll ¶
func (v *SourceView) FoldAll()
func (*SourceView) FoldingEnabled ¶
func (v *SourceView) FoldingEnabled() bool
func (*SourceView) FoldingRegions ¶
func (v *SourceView) FoldingRegions() []FoldRegion
func (*SourceView) HighlightOccurrences ¶
func (v *SourceView) HighlightOccurrences() bool
func (*SourceView) HighlightSearchMatches ¶
func (v *SourceView) HighlightSearchMatches() bool
HighlightSearchMatches reports whether search backgrounds are drawn. New views highlight matches, including searches made without a FindBar.
func (*SourceView) IMContext ¶
func (v *SourceView) IMContext() gui.IMContext
func (*SourceView) Indent ¶
func (v *SourceView) Indent(outdent bool) error
func (*SourceView) IndentOptions ¶
func (v *SourceView) IndentOptions() IndentOptions
func (*SourceView) InsertLine ¶
func (v *SourceView) InsertLine(below bool) error
InsertLine inserts an indented blank line above/below the caret's logical line. Existing text is preserved, including when there is a selection.
func (*SourceView) JumpToBracket ¶
func (v *SourceView) JumpToBracket() bool
JumpToBracket jumps between a confirmed pair adjacent to the caret. Unknown, unmatched or out-of-budget pairs leave the selection unchanged.
func (*SourceView) KeyBindings ¶
func (v *SourceView) KeyBindings() KeyBindings
KeyBindings returns a mutable deep copy, including when no keys are bound.
func (*SourceView) LayoutVisible ¶
func (v *SourceView) LayoutVisible(viewport geometry.Size, offset geometry.Point)
func (*SourceView) LinkedTags ¶
func (v *SourceView) LinkedTags() bool
LinkedTags controls typed/deleted name mirroring on confirmed markup pairs.
func (*SourceView) Measure ¶
func (v *SourceView) Measure(c layout.Constraint) layout.Measurement
func (*SourceView) MoveLines ¶
func (v *SourceView) MoveLines(down bool) error
MoveLines moves the current logical line or selected lines one row up/down. It preserves indentation and selection direction. A document edge is a no-op.
func (*SourceView) MoveWord ¶
func (v *SourceView) MoveWord(forward, extend bool)
MoveWord moves to the previous code-word start or next code-word end.
func (*SourceView) Paint ¶
func (v *SourceView) Paint(p gui.Painter)
func (*SourceView) Paste ¶
func (v *SourceView) Paste() error
Paste accepts an asynchronous request. Delayed failures are reported through ConnectError. A changed document, selection or mount cancels the request.
func (*SourceView) ReadOnly ¶
func (v *SourceView) ReadOnly() bool
func (*SourceView) Redo ¶
func (v *SourceView) Redo() bool
func (*SourceView) ReplaceAll ¶
func (v *SourceView) ReplaceAll(text string) (int, error)
func (*SourceView) ReplaceCurrent ¶
func (v *SourceView) ReplaceCurrent(text string) (bool, error)
func (*SourceView) ReplaceSelection ¶
func (v *SourceView) ReplaceSelection(text string) error
func (*SourceView) RevealSelection ¶
func (v *SourceView) RevealSelection()
func (*SourceView) Rulers ¶
func (v *SourceView) Rulers() []int
func (*SourceView) Search ¶
func (v *SourceView) Search() SearchQuery
func (*SourceView) SearchError ¶
func (v *SourceView) SearchError() error
SearchError reports a malformed regular expression. Invalid queries retain their text for editing, produce no matches and never mutate the document.
func (*SourceView) SearchRange ¶
func (v *SourceView) SearchRange() (textedit.Range, bool)
SearchRange is independent of the current selection and FindNext results.
func (*SourceView) SelectLine ¶
func (v *SourceView) SelectLine()
SelectLine expands to whole logical lines, including the following LF. Repeating the command extends the selection one more line downward.
func (*SourceView) Selection ¶
func (v *SourceView) Selection() textedit.Selection
func (*SourceView) SetAcceptsTab ¶
func (v *SourceView) SetAcceptsTab(value bool)
func (*SourceView) SetAutoPairs ¶
func (v *SourceView) SetAutoPairs(enabled bool)
func (*SourceView) SetAutomaticCompletion ¶
func (v *SourceView) SetAutomaticCompletion(enabled bool)
func (*SourceView) SetCompletionProvider ¶
func (v *SourceView) SetCompletionProvider(provider *CompletionProvider)
func (*SourceView) SetDocument ¶
func (v *SourceView) SetDocument(d *Document)
func (*SourceView) SetFoldingEnabled ¶
func (v *SourceView) SetFoldingEnabled(enabled bool)
func (*SourceView) SetHighlightOccurrences ¶
func (v *SourceView) SetHighlightOccurrences(b bool)
func (*SourceView) SetHighlightSearchMatches ¶
func (v *SourceView) SetHighlightSearchMatches(highlight bool)
SetHighlightSearchMatches changes presentation only. Query, navigation, replacement and ordinary text selection are unaffected. FindBar enables it on open and disables it when closing or releasing an open search session.
func (*SourceView) SetIndentOptions ¶
func (v *SourceView) SetIndentOptions(o IndentOptions) error
func (*SourceView) SetKeyBindings ¶
func (v *SourceView) SetKeyBindings(bindings KeyBindings) error
SetKeyBindings validates and copies a complete replacement table. nil/empty removes all command shortcuts; absent commands have no fallback binding. Gestures require a non-Shift modifier or a function key. Unmodified/Shift-only text, navigation and editing keys belong to ordinary input and popup control. Invalid commands, unsupported gestures or conflicting commands return an error without changing the old table. Same-command aliases are deduplicated. It does not affect ordinary input, IME, menus or direct method calls.
func (*SourceView) SetLinkedTags ¶
func (v *SourceView) SetLinkedTags(b bool)
func (*SourceView) SetReadOnly ¶
func (v *SourceView) SetReadOnly(value bool)
func (*SourceView) SetRulers ¶
func (v *SourceView) SetRulers(columns []int) error
func (*SourceView) SetScheme ¶
func (v *SourceView) SetScheme(s *scheme.Scheme)
SetScheme overrides code-area colors only. nil uses the owning stylesheet.
func (*SourceView) SetSearch ¶
func (v *SourceView) SetSearch(q SearchQuery)
func (*SourceView) SetSearchRange ¶
func (v *SourceView) SetSearchRange(r *textedit.Range) error
SetSearchRange copies a validated byte range. nil searches the whole document. Regex anchors retain the full-document context. Empty ranges may match empty expressions; no caller-owned pointer is retained.
func (*SourceView) SetSelection ¶
func (v *SourceView) SetSelection(s textedit.Selection)
func (*SourceView) SetShowIndentGuides ¶
func (v *SourceView) SetShowIndentGuides(b bool)
func (*SourceView) SetShowLineEndings ¶
func (v *SourceView) SetShowLineEndings(b bool)
func (*SourceView) SetShowLineNumbers ¶
func (v *SourceView) SetShowLineNumbers(show bool)
func (*SourceView) SetSmartBackspace ¶
func (v *SourceView) SetSmartBackspace(b bool)
func (*SourceView) SetSmartHomeEnd ¶
func (v *SourceView) SetSmartHomeEnd(b bool)
func (*SourceView) SetWhitespaceMode ¶
func (v *SourceView) SetWhitespaceMode(mode WhitespaceMode) error
func (*SourceView) SetWrapMode ¶
func (v *SourceView) SetWrapMode(w WrapMode)
func (*SourceView) ShowCompletion ¶
func (v *SourceView) ShowCompletion() error
ShowCompletion requests suggestions at the current caret. No proposals is a normal result. Asynchronous failures are delivered once through ConnectError.
func (*SourceView) ShowIndentGuides ¶
func (v *SourceView) ShowIndentGuides() bool
func (*SourceView) ShowLineEndings ¶
func (v *SourceView) ShowLineEndings() bool
func (*SourceView) ShowLineNumbers ¶
func (v *SourceView) ShowLineNumbers() bool
func (*SourceView) SmartBackspace ¶
func (v *SourceView) SmartBackspace() bool
func (*SourceView) SmartHomeEnd ¶
func (v *SourceView) SmartHomeEnd() bool
func (*SourceView) Snapshot ¶
func (v *SourceView) Snapshot() gui.WidgetInfo
func (*SourceView) StyleChanged ¶
func (v *SourceView) StyleChanged()
func (*SourceView) ToggleBlockComment ¶
func (v *SourceView) ToggleBlockComment() error
ToggleBlockComment wraps the selection or removes its exact configured wrapper. Content is literal; this does not parse or nest block comments.
func (*SourceView) ToggleFold ¶
func (v *SourceView) ToggleFold(line int) bool
func (*SourceView) ToggleLineComment ¶
func (v *SourceView) ToggleLineComment() error
ToggleLineComment uses the language's line marker. Empty configuration is a normal no-op. A selection ending at the next line start excludes that line.
func (*SourceView) Undo ¶
func (v *SourceView) Undo() bool
func (*SourceView) Unfold ¶
func (v *SourceView) Unfold(line int) bool
func (*SourceView) UnfoldAll ¶
func (v *SourceView) UnfoldAll()
func (*SourceView) WhitespaceMode ¶
func (v *SourceView) WhitespaceMode() WhitespaceMode
func (*SourceView) WrapMode ¶
func (v *SourceView) WrapMode() WrapMode
type WhitespaceMode ¶
type WhitespaceMode uint8
const ( WhitespaceNone WhitespaceMode = iota WhitespaceSelection WhitespaceTrailing WhitespaceAll )
type WrapMode ¶
type WrapMode = typography.WrapMode
Source Files
¶
- analysis_work.go
- assistance.go
- assistance_paint.go
- commands.go
- comments.go
- completion.go
- completion_list.go
- completion_panel.go
- completion_worker.go
- document.go
- editing_commands.go
- editing_keys.go
- find_bar.go
- find_bar_appearance.go
- find_bar_search.go
- folding.go
- folding_paint.go
- folding_worker.go
- goto_bar.go
- ime.go
- input.go
- key_bindings.go
- layout.go
- layout_work.go
- line_commands.go
- menu.go
- pairs.go
- scheduler.go
- search_range.go
- sourceview.go
- style_colors.go
- styles.go
- styles_basic.go
- styles_controls.go
- styles_modern.go
- tags.go
- visible_lines.go
Directories
¶
| Path | Synopsis |
|---|---|
|
example
|
|
|
declarative
command
Run: go run ./example/declarative.
|
Run: go run ./example/declarative. |
|
editor
command
Run: go run ./example/editor [-theme system|light|dark] [file].
|
Run: go run ./example/editor [-theme system|light|dark] [file]. |
|
markdown
command
Run: go run ./example/markdown [-dark].
|
Run: go run ./example/markdown [-dark]. |
|
markdown/markdown
Package markdown demonstrates an application-owned SourceView language.
|
Package markdown demonstrates an application-owned SourceView language. |
|
internal
|
|
|
editor
Package editor plans source edits without depending on Widgets or native resources.
|
Package editor plans source edits without depending on Widgets or native resources. |
|
resource
Package resource contains SourceView-owned presentation text.
|
Package resource contains SourceView-owned presentation text. |
|
Package language describes the languages and lexical styles supported by SourceView.
|
Package language describes the languages and lexical styles supported by SourceView. |
|
Package scheme provides immutable source-code color schemes.
|
Package scheme provides immutable source-code color schemes. |
|
tests
|
|
|
window/editor
command
SourceView desktop verification.
|
SourceView desktop verification. |
|
window/editor/assistance
command
Native editing assistance verification.
|
Native editing assistance verification. |
|
window/editor/brackets
command
Bracket decoration visual verification.
|
Bracket decoration visual verification. |
|
window/editor/completion
command
Completion panel verification.
|
Completion panel verification. |
|
window/editor/corpus
command
Downloaded-corpus verification.
|
Downloaded-corpus verification. |
|
window/editor/extensions
command
Public extension verification.
|
Public extension verification. |
|
window/editor/find
command
Optional FindBar and declarative lifecycle verification.
|
Optional FindBar and declarative lifecycle verification. |
|
window/editor/find_appearance
command
Find overlay appearance and isolation verification.
|
Find overlay appearance and isolation verification. |
|
window/editor/folding
command
Folding integration verification.
|
Folding integration verification. |
|
window/editor/frame
command
编辑器外框与滚动条组合验证。
|
编辑器外框与滚动条组合验证。 |
|
window/editor/interaction
command
Real desktop input verification; requires a desktop and native typography.
|
Real desktop input verification; requires a desktop and native typography. |
|
window/editor/keybindings
command
Command binding integration verification.
|
Command binding integration verification. |
|
window/editor/languages
command
TOML/YAML/Shell integration verification.
|
TOML/YAML/Shell integration verification. |
|
window/editor/largefiles
command
Medium/large-file functional verification.
|
Medium/large-file functional verification. |
|
window/editor/lines
command
Logical line editing verification.
|
Logical line editing verification. |
|
window/editor/localization
command
Eight-language editor UI verification.
|
Eight-language editor UI verification. |
|
window/editor/longlines
command
Long-line rasterization regression.
|
Long-line rasterization regression. |
|
window/editor/markup
command
Native markup verification; desktop/window manager required.
|
Native markup verification; desktop/window manager required. |
|
window/editor/resize_cache
command
Recent-width layout cache verification.
|
Recent-width layout cache verification. |
|
window/editor/search
command
Native search enhancements verification; desktop/window manager required.
|
Native search enhancements verification; desktop/window manager required. |
|
window/editor/selection
command
Syntax-preserving selection verification.
|
Syntax-preserving selection verification. |
|
window/editor/shortcuts
command
Editor shortcut verification.
|
Editor shortcut verification. |
|
window/experience
command
Editor experience verification.
|
Editor experience verification. |
|
Package ui provides thin GOUI declarative bindings for SourceView.
|
Package ui provides thin GOUI declarative bindings for SourceView. |