Documentation ¶
Index ¶
- Constants
- Variables
- type Buffer
- func (tb *Buffer) AppendTextLineMarkup(text []byte, markup []byte, signal bool) *text.Edit
- func (tb *Buffer) AppendTextMarkup(text []byte, markup []byte, signal bool) *text.Edit
- func (tb *Buffer) AutoIndentRegion(start, end int)
- func (tb *Buffer) AutoSaveCheck() bool
- func (tb *Buffer) AutoSaveDelete()
- func (tb *Buffer) AutoSaveFilename() string
- func (tb *Buffer) AutoScrollEditors()
- func (tb *Buffer) Close(afterFun func(canceled bool)) bool
- func (tb *Buffer) CommentRegion(start, end int)
- func (tb *Buffer) ConfigKnown() bool
- func (tb *Buffer) DeleteLineColor(ln int)
- func (tb *Buffer) DeleteText(st, ed lexer.Pos, signal bool) *text.Edit
- func (tb *Buffer) DiffBuffersUnified(ob *Buffer, context int) []byte
- func (tb *Buffer) FileModCheck() bool
- func (tb *Buffer) HasLineColor(ln int) bool
- func (tb *Buffer) Init()
- func (tb *Buffer) IsNotSaved() bool
- func (tb *Buffer) JoinParaLines(startLine, endLine int)
- func (tb *Buffer) OnChange(fun func(e events.Event))
- func (tb *Buffer) OnInput(fun func(e events.Event))
- func (tb *Buffer) Open(filename core.Filename) error
- func (tb *Buffer) OpenFS(fsys fs.FS, filename string) error
- func (tb *Buffer) ReplaceText(delSt, delEd, insPos lexer.Pos, insTxt string, signal, matchCase bool) *text.Edit
- func (tb *Buffer) Revert() bool
- func (tb *Buffer) Save() error
- func (tb *Buffer) SaveAs(filename core.Filename)
- func (tb *Buffer) SaveAsFunc(filename core.Filename, afterFunc func(canceled bool))
- func (tb *Buffer) SetFileExt(ext string) *Buffer
- func (tb *Buffer) SetFilename(fn string) *Buffer
- func (tb *Buffer) SetLanguage(ftyp fileinfo.Known) *Buffer
- func (tb *Buffer) SetLineColor(ln int, color image.Image)
- func (tb *Buffer) SetReadOnly(readonly bool) *Buffer
- func (tb *Buffer) SetString(txt string) *Buffer
- func (tb *Buffer) SetText(text []byte) *Buffer
- func (tb *Buffer) SpacesToTabs(start, end int)
- func (tb *Buffer) SpellCheckLineErrors(ln int) lexer.Line
- func (tb *Buffer) Stat() error
- func (tb *Buffer) String() string
- func (tb *Buffer) TabsToSpaces(start, end int)
- func (tb *Buffer) Text() []byte
- func (tb *Buffer) Update()
- type DiffEditor
- func DiffEditorDialog(ctx core.Widget, title string, astr, bstr []string, ...) *DiffEditor
- func DiffEditorDialogFromRevs(ctx core.Widget, repo vcs.Repo, file string, fbuf *Buffer, rev_a, rev_b string) (*DiffEditor, error)
- func DiffFiles(ctx core.Widget, afile, bfile string) (*DiffEditor, error)
- func NewDiffEditor(parent ...tree.Node) *DiffEditor
- func (dv *DiffEditor) DiffStrings(astr, bstr []string)
- func (dv *DiffEditor) Init()
- func (dv *DiffEditor) MakeToolbar(p *tree.Plan)
- func (t *DiffEditor) SetFileA(v string) *DiffEditor
- func (t *DiffEditor) SetFileB(v string) *DiffEditor
- func (t *DiffEditor) SetRevisionA(v string) *DiffEditor
- func (t *DiffEditor) SetRevisionB(v string) *DiffEditor
- type DiffTextEditor
- type Editor
- func (ed *Editor) ApplyScenePos()
- func (t *Editor) AsEditor() *Editor
- func (ed *Editor) CancelComplete()
- func (ed *Editor) Clear()
- func (ed *Editor) ClearHighlights()
- func (ed *Editor) Copy(reset bool) *text.Edit
- func (ed *Editor) CopyRect(reset bool) *text.Edit
- func (ed *Editor) CursorNextLink(wraparound bool) bool
- func (ed *Editor) CursorPrevLink(wraparound bool) bool
- func (ed *Editor) CursorStartDoc()
- func (ed *Editor) CursorToHistoryNext() bool
- func (ed *Editor) CursorToHistoryPrev() bool
- func (ed *Editor) Cut() *text.Edit
- func (ed *Editor) CutRect() *text.Edit
- func (ed *Editor) Destroy()
- func (ed *Editor) HasSelection() bool
- func (ed *Editor) HighlightRegion(reg text.Region)
- func (ed *Editor) Init()
- func (ed *Editor) InsertAtCursor(txt []byte)
- func (ed *Editor) IsNotSaved() bool
- func (ed *Editor) JumpToLinePrompt()
- func (ed *Editor) Lookup()
- func (ed *Editor) NeedsLayout()
- func (ed *Editor) OpenLinkAt(pos lexer.Pos) (*paint.TextLink, bool)
- func (ed *Editor) Paste()
- func (ed *Editor) PasteRect()
- func (ed *Editor) PixelToCursor(pt image.Point) lexer.Pos
- func (ed *Editor) Position()
- func (ed *Editor) QReplacePrompt()
- func (ed *Editor) QReplaceReplaceAll(midx int)
- func (ed *Editor) QReplaceStart(find, repl string, lexItems bool)
- func (ed *Editor) ReCaseSelection(c strcase.Cases) string
- func (ed *Editor) RenderWidget()
- func (ed *Editor) SelectReset()
- func (ed *Editor) Selection() *text.Edit
- func (ed *Editor) SetBuffer(buf *Buffer) *Editor
- func (t *Editor) SetCursorColor(v image.Image) *Editor
- func (ed *Editor) SetCursorShow(pos lexer.Pos)
- func (ed *Editor) SetCursorTarget(pos lexer.Pos)
- func (t *Editor) SetCursorWidth(v units.Value) *Editor
- func (t *Editor) SetHighlightColor(v image.Image) *Editor
- func (t *Editor) SetLineNumberColor(v image.Image) *Editor
- func (t *Editor) SetLinkHandler(v func(tl *paint.TextLink)) *Editor
- func (t *Editor) SetSelectColor(v image.Image) *Editor
- func (ed *Editor) SetWidgetValue(value any) error
- func (ed *Editor) ShowContextMenu(e events.Event)
- func (ed *Editor) SizeDown(iter int) bool
- func (ed *Editor) SizeFinal()
- func (ed *Editor) SizeUp()
- func (ed *Editor) Style()
- func (ed *Editor) WidgetValue() any
- type EditorEmbedder
- type ISearch
- type OutputBuffer
- type OutputBufferMarkupFunc
- type QReplace
- type TwinEditors
Constants ¶
const ( // EditSignal is used as an arg for edit methods with a signal arg, indicating // that a signal should be emitted. EditSignal = true // EditNoSignal is used as an arg for edit methods with a signal arg, indicating // that a signal should NOT be emitted. EditNoSignal = false // ReplaceMatchCase is used for MatchCase arg in ReplaceText method ReplaceMatchCase = true // ReplaceNoMatchCase is used for MatchCase arg in ReplaceText method ReplaceNoMatchCase = false )
Variables ¶
var PrevISearchString string
PrevISearchString is the previous ISearch string
Functions ¶
This section is empty.
Types ¶
type Buffer ¶ added in v0.0.10
type Buffer struct { text.Lines // Filename is the filename of the file that was last loaded or saved. // It is used when highlighting code. Filename core.Filename `json:"-" xml:"-"` // Autosave specifies whether the file should be automatically // saved after changes are made. Autosave bool // Info is the full information about the current file. Info fileinfo.FileInfo // LineColors are the colors to use for rendering circles // next to the line numbers of certain lines. LineColors map[int]image.Image // Complete is the functions and data for text completion. Complete *core.Complete `json:"-" xml:"-"` // contains filtered or unexported fields }
Buffer is a buffer of text, which can be viewed by Editor(s). It holds the raw text lines (in original string and rune formats, and marked-up from syntax highlighting), and sends signals for making edits to the text and coordinating those edits across multiple views. Editors always only view a single buffer, so they directly call methods on the buffer to drive updates, which are then broadcast. It also has methods for loading and saving buffers to files. Unlike GUI widgets, its methods generally send events, without an explicit Event suffix. Internally, the buffer represents new lines using \n = LF, but saving and loading can deal with Windows/DOS CRLF format.
func NewBuffer ¶ added in v0.0.10
func NewBuffer() *Buffer
NewBuffer makes a new Buffer with default settings and initializes it.
func (*Buffer) AppendTextLineMarkup ¶ added in v0.0.10
AppendTextLineMarkup appends one line of new text to end of buffer, using insert, and appending a LF at the end of the line if it doesn't already have one. User-supplied markup is used. Returns the edit region.
func (*Buffer) AppendTextMarkup ¶ added in v0.0.10
AppendTextMarkup appends new text to end of buffer, using insert, returns edit, and uses supplied markup to render it.
func (*Buffer) AutoIndentRegion ¶ added in v0.0.10
AutoIndentRegion does auto-indent over given region; end is *exclusive*
func (*Buffer) AutoSaveCheck ¶ added in v0.0.10
AutoSaveCheck checks if an autosave file exists; logic for dealing with it is left to larger app; call this before opening a file.
func (*Buffer) AutoSaveDelete ¶ added in v0.0.10
func (tb *Buffer) AutoSaveDelete()
AutoSaveDelete deletes any existing autosave file
func (*Buffer) AutoSaveFilename ¶ added in v0.0.10
AutoSaveFilename returns the autosave filename.
func (*Buffer) AutoScrollEditors ¶ added in v0.2.1
func (tb *Buffer) AutoScrollEditors()
AutoScrollEditors ensures that our editors are always viewing the end of the buffer
func (*Buffer) Close ¶ added in v0.0.10
Close closes the buffer, prompting to save if there are changes, and disconnects from editors. If afterFun is non-nil, then it is called with the status of the user action.
func (*Buffer) CommentRegion ¶ added in v0.0.10
CommentRegion inserts comment marker on given lines; end is *exclusive*
func (*Buffer) ConfigKnown ¶ added in v0.0.10
ConfigKnown configures options based on the supported language info in parse. Returns true if supported.
func (*Buffer) DeleteLineColor ¶ added in v0.0.10
DeleteLineColor deletes the line color at the given line.
func (*Buffer) DeleteText ¶ added in v0.0.10
DeleteText is the primary method for deleting text from the buffer. It deletes region of text between start and end positions, optionally signaling views after text lines have been updated. Sets the timestamp on resulting Edit to now. An Undo record is automatically saved depending on Undo.Off setting.
func (*Buffer) DiffBuffersUnified ¶ added in v0.0.10
DiffBuffersUnified computes the diff between this buffer and the other buffer, returning a unified diff with given amount of context (default of 3 will be used if -1)
func (*Buffer) FileModCheck ¶ added in v0.0.10
FileModCheck checks if the underlying file has been modified since last Stat (open, save); if haven't yet prompted, user is prompted to ensure that this is OK. It returns true if the file was modified.
func (*Buffer) HasLineColor ¶ added in v0.0.10
HasLineColor checks if given line has a line color set
func (*Buffer) Init ¶ added in v0.3.0
func (tb *Buffer) Init()
Init initializes the buffer. Called automatically in SetText.
func (*Buffer) IsNotSaved ¶ added in v0.0.10
IsNotSaved returns true if buffer was changed (edited) since last Save.
func (*Buffer) JoinParaLines ¶ added in v0.0.10
JoinParaLines merges sequences of lines with hard returns forming paragraphs, separated by blank lines, into a single line per paragraph, within the given line regions; endLine is *inclusive*
func (*Buffer) OnChange ¶ added in v0.0.10
OnChange adds an event listener function for the events.Change event.
func (*Buffer) OnInput ¶ added in v0.0.10
OnInput adds an event listener function for the events.Input event.
func (*Buffer) OpenFS ¶ added in v0.0.10
OpenFS loads the given file in the given filesystem into the buffer.
func (*Buffer) ReplaceText ¶ added in v0.0.10
func (tb *Buffer) ReplaceText(delSt, delEd, insPos lexer.Pos, insTxt string, signal, matchCase bool) *text.Edit
ReplaceText does DeleteText for given region, and then InsertText at given position (typically same as delSt but not necessarily), optionally emitting a signal after the insert. if matchCase is true, then the lexer.MatchCase function is called to match the case (upper / lower) of the new inserted text to that of the text being replaced. returns the text.Edit for the inserted text.
func (*Buffer) Revert ¶ added in v0.0.10
Revert re-opens text from the current file, if the filename is set; returns false if not. It uses an optimized diff-based update to preserve existing formatting, making it very fast if not very different.
func (*Buffer) Save ¶ added in v0.0.10
Save saves the current text into the current filename associated with this buffer.
func (*Buffer) SaveAs ¶ added in v0.0.10
SaveAs saves the current text into given file; does an editDone first to save edits and checks for an existing file; if it does exist then prompts to overwrite or not.
func (*Buffer) SaveAsFunc ¶ added in v0.0.10
SaveAsFunc saves the current text into the given file. Does an editDone first to save edits and checks for an existing file. If it does exist then prompts to overwrite or not. If afterFunc is non-nil, then it is called with the status of the user action.
func (*Buffer) SetFileExt ¶ added in v0.3.0
SetFileExt sets syntax highlighting and other parameters based on the given file extension (without the . prefix), for cases where an actual file with fileinfo.FileInfo is not available.
func (*Buffer) SetFilename ¶ added in v0.0.10
SetFilename sets the filename associated with the buffer and updates the code highlighting information accordingly.
func (*Buffer) SetLanguage ¶ added in v0.2.3
SetFileType sets the syntax highlighting and other parameters based on the given fileinfo.Known file type
func (*Buffer) SetLineColor ¶ added in v0.0.10
SetLineColor sets the color to use for rendering a circle next to the line number at the given line.
func (*Buffer) SetReadOnly ¶ added in v0.0.10
SetReadOnly sets whether the buffer is read-only.
func (*Buffer) SetText ¶ added in v0.0.10
SetText sets the text to the given bytes. Pass nil to initialize an empty buffer.
func (*Buffer) SpacesToTabs ¶ added in v0.0.10
SpacesToTabs replaces tabs with spaces over given region; end is *exclusive*
func (*Buffer) SpellCheckLineErrors ¶ added in v0.2.1
SpellCheckLineErrors runs spell check on given line, and returns Lex tags with token.TextSpellErr for any misspelled words
func (*Buffer) Stat ¶ added in v0.0.10
Stat gets info about the file, including the highlighting language.
func (*Buffer) String ¶ added in v0.1.1
String returns the current text as a string, applying all current changes by calling editDone, which will generate a signal if there have been changes.
func (*Buffer) TabsToSpaces ¶ added in v0.0.10
TabsToSpaces replaces tabs with spaces over given region; end is *exclusive*
type DiffEditor ¶ added in v0.2.0
type DiffEditor struct { core.Frame // first file name being compared FileA string // second file name being compared FileB string // revision for first file, if relevant RevisionA string // revision for second file, if relevant RevisionB string // contains filtered or unexported fields }
DiffEditor presents two side-by-side [Editor]s showing the differences between two files (represented as lines of strings).
func DiffEditorDialog ¶ added in v0.2.0
func DiffEditorDialog(ctx core.Widget, title string, astr, bstr []string, afile, bfile, arev, brev string) *DiffEditor
DiffEditorDialog opens a dialog for displaying diff between two files as line-strings
func DiffEditorDialogFromRevs ¶ added in v0.2.0
func DiffEditorDialogFromRevs(ctx core.Widget, repo vcs.Repo, file string, fbuf *Buffer, rev_a, rev_b string) (*DiffEditor, error)
DiffEditorDialogFromRevs opens a dialog for displaying diff between file at two different revisions from given repository if empty, defaults to: A = current HEAD, B = current WC file. -1, -2 etc also work as universal ways of specifying prior revisions.
func DiffFiles ¶
func DiffFiles(ctx core.Widget, afile, bfile string) (*DiffEditor, error)
DiffFiles shows the diffs between this file as the A file, and other file as B file, in a DiffEditorDialog
func NewDiffEditor ¶ added in v0.2.0
func NewDiffEditor(parent ...tree.Node) *DiffEditor
NewDiffEditor returns a new DiffEditor with the given optional parent: DiffEditor presents two side-by-side [Editor]s showing the differences between two files (represented as lines of strings).
func (*DiffEditor) DiffStrings ¶ added in v0.2.0
func (dv *DiffEditor) DiffStrings(astr, bstr []string)
DiffStrings computes differences between two lines-of-strings and displays in DiffEditor.
func (*DiffEditor) Init ¶ added in v0.2.0
func (dv *DiffEditor) Init()
func (*DiffEditor) MakeToolbar ¶ added in v0.2.0
func (dv *DiffEditor) MakeToolbar(p *tree.Plan)
func (*DiffEditor) SetFileA ¶ added in v0.2.0
func (t *DiffEditor) SetFileA(v string) *DiffEditor
SetFileA sets the [DiffEditor.FileA]: first file name being compared
func (*DiffEditor) SetFileB ¶ added in v0.2.0
func (t *DiffEditor) SetFileB(v string) *DiffEditor
SetFileB sets the [DiffEditor.FileB]: second file name being compared
func (*DiffEditor) SetRevisionA ¶ added in v0.2.3
func (t *DiffEditor) SetRevisionA(v string) *DiffEditor
SetRevisionA sets the [DiffEditor.RevisionA]: revision for first file, if relevant
func (*DiffEditor) SetRevisionB ¶ added in v0.2.3
func (t *DiffEditor) SetRevisionB(v string) *DiffEditor
SetRevisionB sets the [DiffEditor.RevisionB]: revision for second file, if relevant
type DiffTextEditor ¶
type DiffTextEditor struct {
Editor
}
DiffTextEditor supports double-click based application of edits from one buffer to the other.
func NewDiffTextEditor ¶
func NewDiffTextEditor(parent ...tree.Node) *DiffTextEditor
NewDiffTextEditor returns a new DiffTextEditor with the given optional parent: DiffTextEditor supports double-click based application of edits from one buffer to the other.
func (*DiffTextEditor) Init ¶ added in v0.2.0
func (ed *DiffTextEditor) Init()
type Editor ¶
type Editor struct { core.Frame // Buffer is the text buffer being edited. Buffer *Buffer `set:"-" json:"-" xml:"-"` // CursorWidth is the width of the cursor. // This should be set in Stylers like all other style properties. CursorWidth units.Value // LineNumberColor is the color used for the side bar containing the line numbers. // This should be set in Stylers like all other style properties. LineNumberColor image.Image // SelectColor is the color used for the user text selection background color. // This should be set in Stylers like all other style properties. SelectColor image.Image // HighlightColor is the color used for the text highlight background color (like in find). // This should be set in Stylers like all other style properties. HighlightColor image.Image // CursorColor is the color used for the text editor cursor bar. // This should be set in Stylers like all other style properties. CursorColor image.Image // NumLines is the number of lines in the view, synced with the [Buffer] after edits, // but always reflects the storage size of renders etc. NumLines int `set:"-" display:"-" json:"-" xml:"-"` // LineNumberOffset is the horizontal offset for the start of text after line numbers. LineNumberOffset float32 `set:"-" display:"-" json:"-" xml:"-"` // CursorPos is the current cursor position. CursorPos lexer.Pos `set:"-" edit:"-" json:"-" xml:"-"` // SelectRegion is the current selection region. SelectRegion text.Region `set:"-" edit:"-" json:"-" xml:"-"` // Highlights is a slice of regions representing the highlighted regions, e.g., for search results. Highlights []text.Region `set:"-" edit:"-" json:"-" xml:"-"` // LinkHandler handles link clicks. // If it is nil, they are sent to the standard web URL handler. LinkHandler func(tl *paint.TextLink) // ISearch is the interactive search data. ISearch ISearch `set:"-" edit:"-" json:"-" xml:"-"` // QReplace is the query replace data. QReplace QReplace `set:"-" edit:"-" json:"-" xml:"-"` // contains filtered or unexported fields }
Editor is a widget for editing multiple lines of complicated text (as compared to core.TextField for a single line of simple text). The Editor is driven by a Buffer buffer which contains all the text, and manages all the edits, sending update events out to the editors.
Use NeedsRender to drive an render update for any change that does not change the line-level layout of the text. Use NeedsLayout whenever there are changes across lines that require re-layout of the text. This sets the Widget NeedsRender flag and triggers layout during that render.
Multiple editors can be attached to a given buffer. All updating in the Editor should be within a single goroutine, as it would require extensive protections throughout code otherwise.
func AsEditor ¶
AsEditor returns the given value as a value of type Editor if the type of the given value embeds Editor, or nil otherwise
func NewEditor ¶
NewEditor returns a new Editor with the given optional parent: Editor is a widget for editing multiple lines of complicated text (as compared to core.TextField for a single line of simple text). The Editor is driven by a Buffer buffer which contains all the text, and manages all the edits, sending update events out to the editors.
Use NeedsRender to drive an render update for any change that does not change the line-level layout of the text. Use NeedsLayout whenever there are changes across lines that require re-layout of the text. This sets the Widget NeedsRender flag and triggers layout during that render.
Multiple editors can be attached to a given buffer. All updating in the Editor should be within a single goroutine, as it would require extensive protections throughout code otherwise.
func TextDialog ¶
TextDialog opens a dialog for displaying text string
func (*Editor) ApplyScenePos ¶ added in v0.2.1
func (ed *Editor) ApplyScenePos()
func (*Editor) AsEditor ¶
AsEditor satisfies the EditorEmbedder interface
func (*Editor) CancelComplete ¶
func (ed *Editor) CancelComplete()
CancelComplete cancels any pending completion. Call this when new events have moved beyond any prior completion scenario.
func (*Editor) Clear ¶
func (ed *Editor) Clear()
Clear resets all the text in the buffer for this editor.
func (*Editor) ClearHighlights ¶
func (ed *Editor) ClearHighlights()
ClearHighlights clears the Highlights slice of all regions
func (*Editor) Copy ¶
Copy copies any selected text to the clipboard, and returns that text, optionally resetting the current selection
func (*Editor) CopyRect ¶
CopyRect copies any selected text to the clipboard, and returns that text, optionally resetting the current selection
func (*Editor) CursorNextLink ¶
CursorNextLink moves cursor to next link. wraparound wraps around to top of buffer if none found -- returns true if found
func (*Editor) CursorPrevLink ¶
CursorPrevLink moves cursor to previous link. wraparound wraps around to bottom of buffer if none found. returns true if found
func (*Editor) CursorStartDoc ¶
func (ed *Editor) CursorStartDoc()
CursorStartDoc moves the cursor to the start of the text, updating selection if select mode is active
func (*Editor) CursorToHistoryNext ¶ added in v0.2.3
CursorToHistoryNext moves cursor to previous position on history list -- returns true if moved
func (*Editor) CursorToHistoryPrev ¶ added in v0.2.3
CursorToHistoryPrev moves cursor to previous position on history list -- returns true if moved
func (*Editor) CutRect ¶
CutRect cuts rectangle defined by selected text (upper left to lower right) and adds it to the clipboard, also returns cut text.
func (*Editor) HasSelection ¶
HasSelection returns whether there is a selected region of text
func (*Editor) HighlightRegion ¶
HighlightRegion creates a new highlighted region, triggers updating.
func (*Editor) InsertAtCursor ¶
InsertAtCursor inserts given text at current cursor position
func (*Editor) IsNotSaved ¶
IsNotSaved returns true if buffer was changed (edited) since last Save.
func (*Editor) JumpToLinePrompt ¶ added in v0.0.7
func (ed *Editor) JumpToLinePrompt()
JumpToLinePrompt jumps to given line number (minus 1) from prompt
func (*Editor) Lookup ¶
func (ed *Editor) Lookup()
Lookup attempts to lookup symbol at current location, popping up a window if something is found.
func (*Editor) NeedsLayout ¶ added in v0.0.8
func (ed *Editor) NeedsLayout()
NeedsLayout indicates that the Editor needs a new layout pass.
func (*Editor) OpenLinkAt ¶
OpenLinkAt opens a link at given cursor position, if one exists there -- returns true and the link if there is a link, and false otherwise -- highlights selected link
func (*Editor) Paste ¶
func (ed *Editor) Paste()
Paste inserts text from the clipboard at current cursor position
func (*Editor) PasteRect ¶
func (ed *Editor) PasteRect()
PasteRect inserts text from the clipboard at current cursor position
func (*Editor) PixelToCursor ¶
PixelToCursor finds the cursor position that corresponds to the given pixel location (e.g., from mouse click) which has had ScBBox.Min subtracted from it (i.e, relative to upper left of text area)
func (*Editor) QReplacePrompt ¶ added in v0.0.7
func (ed *Editor) QReplacePrompt()
QReplacePrompt is an emacs-style query-replace mode -- this starts the process, prompting user for items to search etc
func (*Editor) QReplaceReplaceAll ¶
QReplaceReplaceAll replaces all remaining from index
func (*Editor) QReplaceStart ¶
QReplaceStart starts query-replace using given find, replace strings
func (*Editor) ReCaseSelection ¶
ReCaseSelection changes the case of the currently selected text. Returns the new text; empty if nothing selected.
func (*Editor) RenderWidget ¶ added in v0.0.10
func (ed *Editor) RenderWidget()
func (*Editor) Selection ¶
Selection returns the currently selected text as a text.Edit, which captures start, end, and full lines in between -- nil if no selection
func (*Editor) SetBuffer ¶ added in v0.0.10
SetBuffer sets the Buffer that this is an editor of, and interconnects their events.
func (*Editor) SetCursorColor ¶
SetCursorColor sets the [Editor.CursorColor]: CursorColor is the color used for the text editor cursor bar. This should be set in Stylers like all other style properties.
func (*Editor) SetCursorShow ¶
SetCursorShow sets a new cursor position, enforcing it in range, and shows the cursor (scroll to if hidden, render)
func (*Editor) SetCursorTarget ¶
SetCursorTarget sets a new cursor target position, ensures that it is visible
func (*Editor) SetCursorWidth ¶
SetCursorWidth sets the [Editor.CursorWidth]: CursorWidth is the width of the cursor. This should be set in Stylers like all other style properties.
func (*Editor) SetHighlightColor ¶
SetHighlightColor sets the [Editor.HighlightColor]: HighlightColor is the color used for the text highlight background color (like in find). This should be set in Stylers like all other style properties.
func (*Editor) SetLineNumberColor ¶
SetLineNumberColor sets the [Editor.LineNumberColor]: LineNumberColor is the color used for the side bar containing the line numbers. This should be set in Stylers like all other style properties.
func (*Editor) SetLinkHandler ¶
SetLinkHandler sets the [Editor.LinkHandler]: LinkHandler handles link clicks. If it is nil, they are sent to the standard web URL handler.
func (*Editor) SetSelectColor ¶
SetSelectColor sets the [Editor.SelectColor]: SelectColor is the color used for the user text selection background color. This should be set in Stylers like all other style properties.
func (*Editor) SetWidgetValue ¶ added in v0.3.0
func (*Editor) ShowContextMenu ¶
ShowContextMenu displays the context menu with options dependent on situation
func (*Editor) WidgetValue ¶ added in v0.2.0
type EditorEmbedder ¶
type EditorEmbedder interface {
AsEditor() *Editor
}
EditorEmbedder is an interface that all types that embed Editor satisfy
type ISearch ¶
type ISearch struct { // if true, in interactive search mode On bool `json:"-" xml:"-"` // current interactive search string Find string `json:"-" xml:"-"` // current search matches Matches []text.Match `json:"-" xml:"-"` // contains filtered or unexported fields }
ISearch holds all the interactive search data
type OutputBuffer ¶ added in v0.0.10
type OutputBuffer struct { // the output that we are reading from, as an io.Reader Output io.Reader // the [Buffer] that we output to Buffer *Buffer // how much time to wait while batching output (default: 200ms) Batch time.Duration // optional markup function that adds html tags to given line of output -- essential that it ONLY adds tags, and otherwise has the exact same visible bytes as the input MarkupFunc OutputBufferMarkupFunc // contains filtered or unexported fields }
OutputBuffer is a Buffer that records the output from an io.Reader using bufio.Scanner. It is optimized to combine fast chunks of output into large blocks of updating. It also supports an arbitrary markup function that operates on each line of output bytes.
func (*OutputBuffer) MonitorOutput ¶ added in v0.0.10
func (ob *OutputBuffer) MonitorOutput()
MonitorOutput monitors the output and updates the Buffer.
func (*OutputBuffer) SetBatch ¶ added in v0.2.3
func (t *OutputBuffer) SetBatch(v time.Duration) *OutputBuffer
SetBatch sets the [OutputBuffer.Batch]: how much time to wait while batching output (default: 200ms)
func (*OutputBuffer) SetBuffer ¶ added in v0.2.3
func (t *OutputBuffer) SetBuffer(v *Buffer) *OutputBuffer
SetBuffer sets the [OutputBuffer.Buffer]: the Buffer that we output to
func (*OutputBuffer) SetMarkupFunc ¶ added in v0.2.3
func (t *OutputBuffer) SetMarkupFunc(v OutputBufferMarkupFunc) *OutputBuffer
SetMarkupFunc sets the [OutputBuffer.MarkupFunc]: optional markup function that adds html tags to given line of output -- essential that it ONLY adds tags, and otherwise has the exact same visible bytes as the input
func (*OutputBuffer) SetOutput ¶ added in v0.2.3
func (t *OutputBuffer) SetOutput(v io.Reader) *OutputBuffer
SetOutput sets the [OutputBuffer.Output]: the output that we are reading from, as an io.Reader
type OutputBufferMarkupFunc ¶ added in v0.0.10
OutputBufferMarkupFunc is a function that returns a marked-up version of a given line of output text by adding html tags. It is essential that it ONLY adds tags, and otherwise has the exact same visible bytes as the input
type QReplace ¶
type QReplace struct { // if true, in interactive search mode On bool `json:"-" xml:"-"` // current interactive search string Find string `json:"-" xml:"-"` // current interactive search string Replace string `json:"-" xml:"-"` // current search matches Matches []text.Match `json:"-" xml:"-"` // contains filtered or unexported fields }
QReplace holds all the query-replace data
type TwinEditors ¶
type TwinEditors struct { core.Splits // [Buffer] for A BufferA *Buffer `json:"-" xml:"-"` // [Buffer] for B BufferB *Buffer `json:"-" xml:"-"` // contains filtered or unexported fields }
TwinEditors presents two side-by-side [Editor]s in core.Splits that scroll in sync with each other.
func NewTwinEditors ¶
func NewTwinEditors(parent ...tree.Node) *TwinEditors
NewTwinEditors returns a new TwinEditors with the given optional parent: TwinEditors presents two side-by-side [Editor]s in core.Splits that scroll in sync with each other.
func (*TwinEditors) Editors ¶
func (te *TwinEditors) Editors() (*Editor, *Editor)
Editors returns the two text [Editor]s.
func (*TwinEditors) Init ¶ added in v0.2.0
func (te *TwinEditors) Init()
func (*TwinEditors) SetBufferA ¶ added in v0.2.0
func (t *TwinEditors) SetBufferA(v *Buffer) *TwinEditors
SetBufferA sets the [TwinEditors.BufferA]: Buffer for A
func (*TwinEditors) SetBufferB ¶ added in v0.2.0
func (t *TwinEditors) SetBufferB(v *Buffer) *TwinEditors
SetBufferB sets the [TwinEditors.BufferB]: Buffer for B
func (*TwinEditors) SetFiles ¶
func (te *TwinEditors) SetFiles(fileA, fileB string)
SetFiles sets the files for each Buffer.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package difflib is a partial port of Python difflib module.
|
Package difflib is a partial port of Python difflib module. |
bytes
Package bytes is a partial port of Python difflib module for bytes.
|
Package bytes is a partial port of Python difflib module for bytes. |
Package highlighting provides syntax highlighting styles; it is based on github.com/alecthomas/chroma, which in turn was based on the python pygments package.
|
Package highlighting provides syntax highlighting styles; it is based on github.com/alecthomas/chroma, which in turn was based on the python pygments package. |