Documentation ¶
Index ¶
- Constants
- Variables
- func ChromaTagsForLine(tags *lex.Line, toks []chroma.Token)
- func ChromaTagsLine(lexer chroma.Lexer, txt []rune) (lex.Line, error)
- func CompleteEditPi(data any, text string, cursorPos int, comp complete.Completion, seed string) (ed complete.Edit)
- func CompletePi(data any, text string, posLn, posCh int) (md complete.Matches)
- func CompleteText(data any, text string, posLn, posCh int) (md complete.Matches)
- func CompleteTextEdit(data any, text string, cursorPos int, completion complete.Completion, ...) (ed complete.Edit)
- func HTMLEscapeBytes(b []byte) []byte
- func HTMLEscapeRunes(r []rune) []byte
- func LookupPi(data any, text string, posLn, posCh int) (ld complete.Lookup)
- func ViewBlink()
- func ViewClipHistAdd(clip []byte)
- func ViewClipHistChooseList() []string
- type Buf
- func (tb *Buf) AddTag(ln, st, ed int, tag token.Tokens)
- func (tb *Buf) AddTagEdit(tbe *textbuf.Edit, tag token.Tokens)
- func (tb *Buf) AddView(vw *Editor)
- func (tb *Buf) AdjustPos(pos lex.Pos, t time.Time, del textbuf.AdjustPosDel) lex.Pos
- func (tb *Buf) AdjustReg(reg textbuf.Region) textbuf.Region
- func (tb *Buf) AdjustedTags(ln int) lex.Line
- func (tb *Buf) AdjustedTagsImpl(tags lex.Line, ln int) lex.Line
- func (tb *Buf) AppendText(text []byte, signal bool) *textbuf.Edit
- func (tb *Buf) AppendTextLine(text []byte, signal bool) *textbuf.Edit
- func (tb *Buf) AppendTextLineMarkup(text []byte, markup []byte, signal bool) *textbuf.Edit
- func (tb *Buf) AppendTextMarkup(text []byte, markup []byte, signal bool) *textbuf.Edit
- func (tb *Buf) AutoIndent(ln int) (tbe *textbuf.Edit, indLev, chPos int)
- func (tb *Buf) AutoIndentRegion(st, ed int)
- func (tb *Buf) AutoSave() error
- func (tb *Buf) AutoSaveCheck() bool
- func (tb *Buf) AutoSaveDelete()
- func (tb *Buf) AutoSaveFilename() string
- func (tb *Buf) AutoSaveOff() bool
- func (tb *Buf) AutoSaveRestore(asv bool)
- func (tb *Buf) AutoScrollViews()
- func (tb *Buf) BatchUpdateEnd(autoSave bool)
- func (tb *Buf) BatchUpdateStart() (autoSave bool)
- func (tb *Buf) BraceMatch(r rune, st lex.Pos) (en lex.Pos, found bool)
- func (tb *Buf) BytesLine(ln int) []byte
- func (tb *Buf) BytesToLines()
- func (tb *Buf) ClearChanged()
- func (tb *Buf) ClearNotSaved()
- func (tb *Buf) Close(afterFun func(canceled bool)) bool
- func (tb *Buf) CommentRegion(st, ed int)
- func (tb *Buf) CommentStart(ln int) int
- func (tb *Buf) CompleteExtend(s string)
- func (tb *Buf) CompleteText(s string)
- func (tb *Buf) ConfigKnown() bool
- func (tb *Buf) CorrectClear(s string)
- func (tb *Buf) CorrectText(s string)
- func (tb *Buf) DeleteCompleter()
- func (tb *Buf) DeleteLineColor(ln int)
- func (tb *Buf) DeleteLineIcon(ln int)
- func (tb *Buf) DeleteSpell()
- func (tb *Buf) DeleteText(st, ed lex.Pos, signal bool) *textbuf.Edit
- func (tb *Buf) DeleteTextImpl(st, ed lex.Pos) *textbuf.Edit
- func (tb *Buf) DeleteTextRect(st, ed lex.Pos, signal bool) *textbuf.Edit
- func (tb *Buf) DeleteTextRectImpl(st, ed lex.Pos) *textbuf.Edit
- func (tb *Buf) DeleteView(vw *Editor)
- func (tb *Buf) DiffBufs(ob *Buf) textbuf.Diffs
- func (tb *Buf) DiffBufsUnified(ob *Buf, context int) []byte
- func (tb *Buf) EditDone()
- func (tb *Buf) EmacsUndoSave()
- func (tb *Buf) EndPos() lex.Pos
- func (tb *Buf) FileModCheck() bool
- func (tb *Buf) FlagType() enums.BitFlagSetter
- func (tb *Buf) HasLineColor(ln int) bool
- func (tb *Buf) HiTagAtPos(pos lex.Pos) (*lex.Lex, int)
- func (tb *Buf) InComment(pos lex.Pos) bool
- func (tb *Buf) InLitString(pos lex.Pos) bool
- func (tb *Buf) InTokenCode(pos lex.Pos) bool
- func (tb *Buf) InTokenSubCat(pos lex.Pos, subCat token.Tokens) bool
- func (tb *Buf) IndentLine(ln, ind int) *textbuf.Edit
- func (tb *Buf) InitialMarkup()
- func (tb *Buf) InsertText(st lex.Pos, text []byte, signal bool) *textbuf.Edit
- func (tb *Buf) InsertTextImpl(st lex.Pos, text []byte) *textbuf.Edit
- func (tb *Buf) InsertTextRect(tbe *textbuf.Edit, signal bool) *textbuf.Edit
- func (tb *Buf) InsertTextRectImpl(tbe *textbuf.Edit) *textbuf.Edit
- func (tb *Buf) Is(flag enums.BitFlag) bool
- func (tb *Buf) IsChanged() bool
- func (tb *Buf) IsMarkingUp() bool
- func (tb *Buf) IsNotSaved() bool
- func (tb *Buf) IsSpellEnabled(pos lex.Pos) bool
- func (tb *Buf) IsValidLine(ln int) bool
- func (tb *Buf) JoinParaLines(stLn, edLn int)
- func (tb *Buf) LexObjPathString(ln int, lx *lex.Lex) string
- func (tb *Buf) LexString(ln int, lx *lex.Lex) string
- func (tb *Buf) Line(ln int) []rune
- func (tb *Buf) LineCommented(ln int) bool
- func (tb *Buf) LineLen(ln int) int
- func (tb *Buf) LinesDeleted(tbe *textbuf.Edit)
- func (tb *Buf) LinesEdited(tbe *textbuf.Edit)
- func (tb *Buf) LinesInserted(tbe *textbuf.Edit)
- func (tb *Buf) LinesToBytes()
- func (tb *Buf) LinesToBytesCopy() []byte
- func (tb *Buf) MarkupAllLines(maxLines int)
- func (tb *Buf) MarkupFromTags()
- func (tb *Buf) MarkupLine(ln int)
- func (tb *Buf) MarkupLines(st, ed int) bool
- func (tb *Buf) MarkupLinesLock(st, ed int) bool
- func (tb *Buf) NewBuf(nlines int)
- func (tb *Buf) NumLines() int
- func (tb *Buf) OnChange(fun func(e events.Event))
- func (tb *Buf) OnInput(fun func(e events.Event))
- func (tb *Buf) Open(filename gi.FileName) error
- func (tb *Buf) OpenFile(filename gi.FileName) error
- func (tb *Buf) PatchFromBuf(ob *Buf, diffs textbuf.Diffs, signal bool) bool
- func (tb *Buf) ReMarkup()
- func (tb *Buf) Redo() *textbuf.Edit
- func (tb *Buf) Region(st, ed lex.Pos) *textbuf.Edit
- func (tb *Buf) RegionImpl(st, ed lex.Pos) *textbuf.Edit
- func (tb *Buf) RegionRect(st, ed lex.Pos) *textbuf.Edit
- func (tb *Buf) RegionRectImpl(st, ed lex.Pos) *textbuf.Edit
- func (tb *Buf) RemoveTag(pos lex.Pos, tag token.Tokens) (reg lex.Lex, ok bool)
- func (tb *Buf) ReplaceText(delSt, delEd, insPos lex.Pos, insTxt string, signal, matchCase bool) *textbuf.Edit
- func (tb *Buf) Revert() bool
- func (tb *Buf) Save() error
- func (tb *Buf) SaveAs(filename gi.FileName)
- func (tb *Buf) SaveAsFunc(filename gi.FileName, afterFunc func(canceled bool))
- func (tb *Buf) SaveFile(filename gi.FileName) error
- func (tb *Buf) SavePosHistory(pos lex.Pos) bool
- func (tb *Buf) SaveUndo(tbe *textbuf.Edit)
- func (tb *Buf) SceneFromView() *gi.Scene
- func (tb *Buf) Search(find []byte, ignoreCase, lexItems bool) (int, []textbuf.Match)
- func (tb *Buf) SearchRegexp(re *regexp.Regexp) (int, []textbuf.Match)
- func (tb *Buf) SetByteOffs()
- func (tb *Buf) SetChanged()
- func (tb *Buf) SetCompleter(data any, matchFun complete.MatchFunc, editFun complete.EditFunc, ...)
- func (tb *Buf) SetFilename(fn string) *Buf
- func (tb *Buf) SetFlag(on bool, flag ...enums.BitFlag)
- func (tb *Buf) SetHiStyle(style gi.HiStyleName) *Buf
- func (tb *Buf) SetLineColor(ln int, clr color.RGBA)
- func (tb *Buf) SetLineIcon(ln int, icon icons.Icon)
- func (tb *Buf) SetReadOnly(readonly bool) *Buf
- func (tb *Buf) SetSpell()
- func (tb *Buf) SetText(txt []byte) *Buf
- func (tb *Buf) SetTextLines(lns [][]byte, cpy bool)
- func (tb *Buf) SignalMods()
- func (tb *Buf) SignalViews(sig BufSignals, edit *textbuf.Edit)
- func (tb *Buf) SpacesToTabs(ln int)
- func (tb *Buf) SpacesToTabsRegion(st, ed int)
- func (tb *Buf) SpellCheckLineErrs(ln int) lex.Line
- func (tb *Buf) SpellCheckLineTag(ln int)
- func (tb *Buf) StartDelayedReMarkup()
- func (tb *Buf) Stat() error
- func (tb *Buf) StopDelayedReMarkup()
- func (tb *Buf) Strings(addNewLn bool) []string
- func (tb *Buf) TabsToSpaces(ln int)
- func (tb *Buf) TabsToSpacesRegion(st, ed int)
- func (tb *Buf) TagAt(pos lex.Pos) (reg lex.Lex, ok bool)
- func (tb *Buf) Text() []byte
- func (tb *Buf) Undo() *textbuf.Edit
- func (tb *Buf) Update()
- func (tb *Buf) ValidPos(pos lex.Pos) lex.Pos
- type BufFlags
- func (i BufFlags) BitIndexString() string
- func (i BufFlags) Desc() string
- func (i BufFlags) HasFlag(f enums.BitFlag) bool
- func (i BufFlags) Int64() int64
- func (i BufFlags) IsValid() bool
- func (i BufFlags) MarshalText() ([]byte, error)
- func (i *BufFlags) SetFlag(on bool, f ...enums.BitFlag)
- func (i *BufFlags) SetInt64(in int64)
- func (i *BufFlags) SetString(s string) error
- func (i *BufFlags) SetStringOr(s string) error
- func (i BufFlags) String() string
- func (i *BufFlags) UnmarshalText(text []byte) error
- func (i BufFlags) Values() []enums.Enum
- type BufList
- type BufSignals
- func (i BufSignals) Desc() string
- func (i BufSignals) Int64() int64
- func (i BufSignals) IsValid() bool
- func (i BufSignals) MarshalText() ([]byte, error)
- func (i *BufSignals) SetInt64(in int64)
- func (i *BufSignals) SetString(s string) error
- func (i BufSignals) String() string
- func (i *BufSignals) UnmarshalText(text []byte) error
- func (i BufSignals) Values() []enums.Enum
- type DiffTextEditor
- func (tv *DiffTextEditor) DiffView() *DiffView
- func (tv *DiffTextEditor) HandleDoubleClick()
- func (t *DiffTextEditor) KiType() *gti.Type
- func (t *DiffTextEditor) New() ki.Ki
- func (tv *DiffTextEditor) OnInit()
- func (t *DiffTextEditor) SetCursorColor(v image.Image) *DiffTextEditor
- func (t *DiffTextEditor) SetCursorWidth(v units.Value) *DiffTextEditor
- func (t *DiffTextEditor) SetHighlightColor(v image.Image) *DiffTextEditor
- func (t *DiffTextEditor) SetLineNumberColor(v image.Image) *DiffTextEditor
- func (t *DiffTextEditor) SetLinkHandler(v func(tl *paint.TextLink)) *DiffTextEditor
- func (t *DiffTextEditor) SetPlaceholder(v string) *DiffTextEditor
- func (t *DiffTextEditor) SetSelectColor(v image.Image) *DiffTextEditor
- func (t *DiffTextEditor) SetStackTop(v int) *DiffTextEditor
- func (t *DiffTextEditor) SetTooltip(v string) *DiffTextEditor
- type DiffView
- func DiffFiles(ctx gi.Widget, afile, bfile string) (*DiffView, error)
- func DiffViewDialog(ctx gi.Widget, title string, astr, bstr []string, ...) *DiffView
- func DiffViewDialogFromRevs(ctx gi.Widget, repo vci.Repo, file string, fbuf *Buf, rev_a, rev_b string) (*DiffView, error)
- func NewDiffView(par ki.Ki, name ...string) *DiffView
- func (dv *DiffView) ApplyDiff(ab int, line int) bool
- func (dv *DiffView) ConfigDiffView()
- func (dv *DiffView) ConfigToolbar(tb *gi.Toolbar)
- func (dv *DiffView) ConfigWidget()
- func (dv *DiffView) DiffStrings(astr, bstr []string)
- func (t *DiffView) KiType() *gti.Type
- func (t *DiffView) New() ki.Ki
- func (dv *DiffView) NextDiff(ab int) bool
- func (dv *DiffView) OnInit()
- func (dv *DiffView) PrevDiff(ab int) bool
- func (dv *DiffView) SaveAs(ab bool, filename gi.FileName)
- func (dv *DiffView) SaveFile(ab bool, filename gi.FileName) error
- func (dv *DiffView) SaveFileA(fname gi.FileName)
- func (dv *DiffView) SaveFileB(fname gi.FileName)
- func (t *DiffView) SetDiffs(v textbuf.DiffSelected) *DiffView
- func (t *DiffView) SetFileA(v string) *DiffView
- func (t *DiffView) SetFileB(v string) *DiffView
- func (t *DiffView) SetRevA(v string) *DiffView
- func (t *DiffView) SetRevB(v string) *DiffView
- func (t *DiffView) SetStackTop(v int) *DiffView
- func (t *DiffView) SetStripes(v gi.Stripes) *DiffView
- func (dv *DiffView) SetStyles()
- func (t *DiffView) SetTooltip(v string) *DiffView
- func (dv *DiffView) TagWordDiffs()
- func (dv *DiffView) TextEditors() (*DiffTextEditor, *DiffTextEditor)
- func (dv *DiffView) UndoDiff(ab int) error
- type Editor
- func (ed *Editor) ApplyStyle()
- func (t *Editor) AsEditor() *Editor
- func (ed *Editor) BufSignal(sig BufSignals, tbe *textbuf.Edit)
- func (ed *Editor) CancelComplete()
- func (ed *Editor) CancelCorrect()
- func (ed *Editor) CharEndPos(pos lex.Pos) mat32.Vec2
- func (ed *Editor) CharStartPos(pos lex.Pos) mat32.Vec2
- func (ed *Editor) CharStartPosVis(pos lex.Pos) mat32.Vec2
- func (ed *Editor) Clear()
- func (ed *Editor) ClearHighlights()
- func (ed *Editor) ClearScopelights()
- func (ed *Editor) ClearSelected()
- func (ed *Editor) ConfigWidget()
- func (ed *Editor) ContextMenu(m *gi.Scene)
- func (ed *Editor) Copy(reset bool) *textbuf.Edit
- func (ed *Editor) CopyRect(reset bool) *textbuf.Edit
- func (ed *Editor) CursorBBox(pos lex.Pos) image.Rectangle
- func (ed *Editor) CursorBackspace(steps int)
- func (ed *Editor) CursorBackspaceWord(steps int)
- func (ed *Editor) CursorBackward(steps int)
- func (ed *Editor) CursorBackwardWord(steps int)
- func (ed *Editor) CursorDelete(steps int)
- func (ed *Editor) CursorDeleteWord(steps int)
- func (ed *Editor) CursorDown(steps int)
- func (ed *Editor) CursorEndDoc()
- func (ed *Editor) CursorEndLine()
- func (ed *Editor) CursorForward(steps int)
- func (ed *Editor) CursorForwardWord(steps int)
- func (ed *Editor) CursorKill()
- func (ed *Editor) CursorMovedSig()
- func (ed *Editor) CursorNextLink(wraparound bool) bool
- func (ed *Editor) CursorPageDown(steps int)
- func (ed *Editor) CursorPageUp(steps int)
- func (ed *Editor) CursorPrevLink(wraparound bool) bool
- func (ed *Editor) CursorRecenter()
- func (ed *Editor) CursorSelect(org lex.Pos)
- func (ed *Editor) CursorSprite(on bool) *gi.Sprite
- func (ed *Editor) CursorSpriteName() string
- func (ed *Editor) CursorStartDoc()
- func (ed *Editor) CursorStartLine()
- func (ed *Editor) CursorToHistNext() bool
- func (ed *Editor) CursorToHistPrev() bool
- func (ed *Editor) CursorTranspose()
- func (ed *Editor) CursorTransposeWord()
- func (ed *Editor) CursorUp(steps int)
- func (ed *Editor) Cut() *textbuf.Edit
- func (ed *Editor) CutRect() *textbuf.Edit
- func (ed *Editor) DeleteSelection() *textbuf.Edit
- func (ed *Editor) EditDone()
- func (ed *Editor) EscPressed()
- func (ed *Editor) FindMatches(find string, useCase, lexItems bool) ([]textbuf.Match, bool)
- func (ed *Editor) FindNextLink(pos lex.Pos) (lex.Pos, textbuf.Region, bool)
- func (ed *Editor) FindPrevLink(pos lex.Pos) (lex.Pos, textbuf.Region, bool)
- func (ed *Editor) FirstVisibleLine(stln int) int
- func (ed *Editor) FlagType() enums.BitFlagSetter
- func (ed *Editor) HandleClose()
- func (ed *Editor) HandleEvents()
- func (ed *Editor) HandleFocus()
- func (ed *Editor) HandleKeyChord()
- func (ed *Editor) HandleLinkCursor()
- func (ed *Editor) HandleMouse()
- func (ed *Editor) HasLineNos() bool
- func (ed *Editor) HasSelection() bool
- func (ed *Editor) HighlightRegion(reg textbuf.Region)
- func (ed *Editor) ISearchBackspace()
- func (ed *Editor) ISearchCancel()
- func (ed *Editor) ISearchKeyInput(kt events.Event)
- func (ed *Editor) ISearchMatches() bool
- func (ed *Editor) ISearchNextMatch(cpos lex.Pos) bool
- func (ed *Editor) ISearchSelectMatch(midx int)
- func (ed *Editor) ISearchSig()
- func (ed *Editor) ISearchStart()
- func (ed *Editor) ISpellKeyInput(kt events.Event)
- func (ed *Editor) InsertAtCursor(txt []byte)
- func (ed *Editor) IsChanged() bool
- func (ed *Editor) IsNotSaved() bool
- func (ed *Editor) IsWordEnd(tp lex.Pos) bool
- func (ed *Editor) IsWordMiddle(tp lex.Pos) bool
- func (ed *Editor) IsWordStart(tp lex.Pos) bool
- func (ed *Editor) JumpToLine(ln int)
- func (ed *Editor) JumpToLineAddText()
- func (ed *Editor) KeyInput(kt events.Event)
- func (ed *Editor) KeyInputInsertBra(kt events.Event)
- func (ed *Editor) KeyInputInsertRune(kt events.Event)
- func (t *Editor) KiType() *gti.Type
- func (ed *Editor) LastVisibleLine(stln int) int
- func (ed *Editor) LayoutAll()
- func (ed *Editor) LayoutAllLines()
- func (ed *Editor) LayoutLine(ln int) bool
- func (ed *Editor) LinesDeleted(tbe *textbuf.Edit)
- func (ed *Editor) LinesInserted(tbe *textbuf.Edit)
- func (ed *Editor) LinkAt(pos lex.Pos) (*paint.TextLink, bool)
- func (ed *Editor) Lookup()
- func (ed *Editor) MatchFromPos(matches []textbuf.Match, cpos lex.Pos) (int, bool)
- func (t *Editor) New() ki.Ki
- func (ed *Editor) OfferComplete()
- func (ed *Editor) OfferCorrect() bool
- func (ed *Editor) OnAdd()
- func (ed *Editor) OnInit()
- func (ed *Editor) OpenLink(tl *paint.TextLink)
- func (ed *Editor) OpenLinkAt(pos lex.Pos) (*paint.TextLink, bool)
- func (ed *Editor) Paste()
- func (ed *Editor) PasteHist()
- func (ed *Editor) PasteRect()
- func (ed *Editor) PixelToCursor(pt image.Point) lex.Pos
- func (ed *Editor) Position()
- func (ed *Editor) QReplaceAddText()
- func (ed *Editor) QReplaceCancel()
- func (ed *Editor) QReplaceKeyInput(kt events.Event)
- func (ed *Editor) QReplaceMatches() bool
- func (ed *Editor) QReplaceNextMatch() bool
- func (ed *Editor) QReplaceReplace(midx int)
- func (ed *Editor) QReplaceReplaceAll(midx int)
- func (ed *Editor) QReplaceSelectMatch(midx int)
- func (ed *Editor) QReplaceSig()
- func (ed *Editor) QReplaceStart(find, repl string, lexItems bool)
- func (ed *Editor) ReCaseSelection(c textbuf.Cases) string
- func (ed *Editor) ReMarkup()
- func (ed *Editor) Redo()
- func (ed *Editor) Render()
- func (ed *Editor) RenderAllLines()
- func (ed *Editor) RenderCursor(on bool)
- func (ed *Editor) RenderDepthBg(stln, edln int)
- func (ed *Editor) RenderHighlights(stln, edln int)
- func (ed *Editor) RenderLineNo(ln int, defFill bool, vpUpload bool)
- func (ed *Editor) RenderLineNosBox(st, end int)
- func (ed *Editor) RenderLineNosBoxAll()
- func (ed *Editor) RenderRegionBox(reg textbuf.Region, bg image.Image)
- func (ed *Editor) RenderRegionBoxSty(reg textbuf.Region, sty *styles.Style, bg image.Image, fullWidth bool)
- func (ed *Editor) RenderRegionToEnd(st lex.Pos, sty *styles.Style, bg image.Image)
- func (ed *Editor) RenderScopelights(stln, edln int)
- func (ed *Editor) RenderSelect()
- func (ed *Editor) RenderSelectLines()
- func (ed *Editor) RenderStartPos() mat32.Vec2
- func (ed *Editor) ResetState()
- func (ed *Editor) SavePosHistory(pos lex.Pos)
- func (ed *Editor) ScenePos()
- func (ed *Editor) ScrollCursorInView() bool
- func (ed *Editor) ScrollCursorToBottom() bool
- func (ed *Editor) ScrollCursorToCenterIfHidden() bool
- func (ed *Editor) ScrollCursorToHorizCenter() bool
- func (ed *Editor) ScrollCursorToLeft() bool
- func (ed *Editor) ScrollCursorToRight() bool
- func (ed *Editor) ScrollCursorToTarget()
- func (ed *Editor) ScrollCursorToTop() bool
- func (ed *Editor) ScrollCursorToVertCenter() bool
- func (ed *Editor) ScrollInView(bbox image.Rectangle) bool
- func (ed *Editor) ScrollToBottom(pos int) bool
- func (ed *Editor) ScrollToHorizCenter(pos int) bool
- func (ed *Editor) ScrollToLeft(pos int) bool
- func (ed *Editor) ScrollToRight(pos int) bool
- func (ed *Editor) ScrollToTop(pos int) bool
- func (ed *Editor) ScrollToVertCenter(pos int) bool
- func (ed *Editor) SelectAll()
- func (ed *Editor) SelectModeToggle()
- func (ed *Editor) SelectRegUpdate(pos lex.Pos)
- func (ed *Editor) SelectReset()
- func (ed *Editor) SelectWord() bool
- func (ed *Editor) Selection() *textbuf.Edit
- func (ed *Editor) SetBuf(buf *Buf) *Editor
- func (ed *Editor) SetCursor(pos lex.Pos)
- func (ed *Editor) SetCursorCol(pos lex.Pos)
- func (t *Editor) SetCursorColor(v image.Image) *Editor
- func (ed *Editor) SetCursorFromMouse(pt image.Point, newPos lex.Pos, selMode events.SelectModes)
- func (ed *Editor) SetCursorShow(pos lex.Pos)
- func (ed *Editor) SetCursorTarget(pos lex.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 (ed *Editor) SetNeedsLayout(updt bool)
- func (t *Editor) SetPlaceholder(v string) *Editor
- func (t *Editor) SetSelectColor(v image.Image) *Editor
- func (t *Editor) SetStackTop(v int) *Editor
- func (ed *Editor) SetStyles()
- func (t *Editor) SetTooltip(v string) *Editor
- func (ed *Editor) ShiftSelect(kt events.Event)
- func (ed *Editor) ShiftSelectExtend(kt events.Event)
- func (ed *Editor) ShowContextMenu(e events.Event)
- func (ed *Editor) SizeFinal()
- func (ed *Editor) SpellCheck(reg *textbuf.Edit) bool
- func (ed *Editor) StartCursor()
- func (ed *Editor) StopCursor()
- func (ed *Editor) StyleSizes()
- func (ed *Editor) StyleView()
- func (ed *Editor) TextStyleProps() ki.Props
- func (ed *Editor) Undo()
- func (ed *Editor) UpdateFromAlloc()
- func (ed *Editor) ValidateCursor()
- func (ed *Editor) WordAt() (reg textbuf.Region)
- func (ed *Editor) WordBefore(tp lex.Pos) *textbuf.Edit
- func (ed *Editor) WrappedLineNo(pos lex.Pos) (si, ri int, ok bool)
- func (ed *Editor) WrappedLines(ln int) int
- type EditorEmbedder
- type EditorFlags
- func (i EditorFlags) BitIndexString() string
- func (i EditorFlags) Desc() string
- func (i EditorFlags) HasFlag(f enums.BitFlag) bool
- func (i EditorFlags) Int64() int64
- func (i EditorFlags) IsValid() bool
- func (i EditorFlags) MarshalText() ([]byte, error)
- func (i *EditorFlags) SetFlag(on bool, f ...enums.BitFlag)
- func (i *EditorFlags) SetInt64(in int64)
- func (i *EditorFlags) SetString(s string) error
- func (i *EditorFlags) SetStringOr(s string) error
- func (i EditorFlags) String() string
- func (i *EditorFlags) UnmarshalText(text []byte) error
- func (i EditorFlags) Values() []enums.Enum
- type HiMarkup
- func (hm *HiMarkup) ChromaTagsAll(txt []byte) ([]lex.Line, error)
- func (hm *HiMarkup) ChromaTagsLine(txt []rune) (lex.Line, error)
- func (hm *HiMarkup) HasHi() bool
- func (hm *HiMarkup) Init(info *fi.FileInfo, pist *pi.FileStates)
- func (hm *HiMarkup) MarkupLine(txt []rune, hitags, tags lex.Line) []byte
- func (hm *HiMarkup) MarkupTagsAll(txt []byte) ([]lex.Line, error)
- func (hm *HiMarkup) MarkupTagsLine(ln int, txt []rune) (lex.Line, error)
- func (hm *HiMarkup) SetHiStyle(style gi.HiStyleName)
- func (hm *HiMarkup) UsingPi() bool
- type ISearch
- type OutBuf
- type OutBufMarkupFunc
- type QReplace
- type TwinEditors
- func (te *TwinEditors) ConfigTexts()
- func (te *TwinEditors) Editors() (*Editor, *Editor)
- func (t *TwinEditors) KiType() *gti.Type
- func (te *TwinEditors) MakeBufs()
- func (t *TwinEditors) New() ki.Ki
- func (te *TwinEditors) OnInit()
- func (t *TwinEditors) SetBufA(v *Buf) *TwinEditors
- func (t *TwinEditors) SetBufB(v *Buf) *TwinEditors
- func (te *TwinEditors) SetFiles(fileA, fileB string, lineNos bool)
- func (t *TwinEditors) SetStackTop(v int) *TwinEditors
- func (te *TwinEditors) SetStyles()
- func (t *TwinEditors) SetTooltip(v string) *TwinEditors
- type Value
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 )
const ( MaxLineLen = 64 * 1024 * 1024 MaxNTags = 1024 )
MaxLineLen prevents overflow in allocating line length
Variables ¶
var ( // Maximum amount of clipboard history to retain ClipHistMax = 100 // `def:"100" min:"0" max:"1000" step:"5"` // maximum number of lines to look for matching scope syntax (parens, brackets) MaxScopeLines = 100 // `def:"100" min:"10" step:"10"` // text buffer max lines to use diff-based revert to more quickly update e.g., after file has been reformatted DiffRevertLines = 10000 // `def:"10000" min:"0" step:"1000"` // text buffer max diffs to use diff-based revert to more quickly update e.g., after file has been reformatted -- if too many differences, just revert DiffRevertDiffs = 20 // `def:"20" min:"0" step:"1"` // amount of time to wait before starting a new background markup process, after text changes within a single line (always does after line insertion / deletion) MarkupDelay = 1000 * time.Millisecond // `def:"1000" min:"100" step:"100"` )
var ( // PrevQReplaceFinds are the previous QReplace strings PrevQReplaceFinds []string // PrevQReplaceRepls are the previous QReplace strings PrevQReplaceRepls []string )
var DiffTextEditorType = gti.AddType(>i.Type{ Name: "goki.dev/gix/texteditor.DiffTextEditor", ShortName: "texteditor.DiffTextEditor", IDName: "diff-text-editor", Doc: "DiffTextEditor supports double-click based application of edits from one\nbuffer to the other.", Directives: gti.Directives{}, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Editor", >i.Field{Name: "Editor", Type: "goki.dev/gix/texteditor.Editor", LocalType: "Editor", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &DiffTextEditor{}, })
DiffTextEditorType is the gti.Type for DiffTextEditor
var DiffViewType = gti.AddType(>i.Type{ Name: "goki.dev/gix/texteditor.DiffView", ShortName: "texteditor.DiffView", IDName: "diff-view", Doc: "DiffView presents two side-by-side TextEditor windows showing the differences\nbetween two files (represented as lines of strings).", Directives: gti.Directives{}, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"FileA", >i.Field{Name: "FileA", Type: "string", LocalType: "string", Doc: "first file name being compared", Directives: gti.Directives{}, Tag: ""}}, {"FileB", >i.Field{Name: "FileB", Type: "string", LocalType: "string", Doc: "second file name being compared", Directives: gti.Directives{}, Tag: ""}}, {"RevA", >i.Field{Name: "RevA", Type: "string", LocalType: "string", Doc: "revision for first file, if relevant", Directives: gti.Directives{}, Tag: ""}}, {"RevB", >i.Field{Name: "RevB", Type: "string", LocalType: "string", Doc: "revision for second file, if relevant", Directives: gti.Directives{}, Tag: ""}}, {"BufA", >i.Field{Name: "BufA", Type: "*goki.dev/gix/texteditor.Buf", LocalType: "*Buf", Doc: "textbuf for A showing the aligned edit view", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\" set:\"-\""}}, {"BufB", >i.Field{Name: "BufB", Type: "*goki.dev/gix/texteditor.Buf", LocalType: "*Buf", Doc: "textbuf for B showing the aligned edit view", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\" set:\"-\""}}, {"AlignD", >i.Field{Name: "AlignD", Type: "goki.dev/gix/texteditor/textbuf.Diffs", LocalType: "textbuf.Diffs", Doc: "aligned diffs records diff for aligned lines", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\" set:\"-\""}}, {"Diffs", >i.Field{Name: "Diffs", Type: "goki.dev/gix/texteditor/textbuf.DiffSelected", LocalType: "textbuf.DiffSelected", Doc: "Diffs applied", Directives: gti.Directives{}, Tag: ""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Frame", >i.Field{Name: "Frame", Type: "goki.dev/gi/v2/gi.Frame", LocalType: "gi.Frame", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{ {"SaveFileA", >i.Method{Name: "SaveFileA", Doc: "SaveFileA saves the current state of file A to given filename", Directives: gti.Directives{ >i.Directive{Tool: "gti", Directive: "add", Args: []string{}}, }, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"fname", >i.Field{Name: "fname", Type: "goki.dev/gi/v2/gi.FileName", LocalType: "gi.FileName", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}}, {"SaveFileB", >i.Method{Name: "SaveFileB", Doc: "SaveFileB saves the current state of file B to given filename", Directives: gti.Directives{ >i.Directive{Tool: "gti", Directive: "add", Args: []string{}}, }, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"fname", >i.Field{Name: "fname", Type: "goki.dev/gi/v2/gi.FileName", LocalType: "gi.FileName", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}}, }), Instance: &DiffView{}, })
DiffViewType is the gti.Type for DiffView
var EditorType = gti.AddType(>i.Type{ Name: "goki.dev/gix/texteditor.Editor", ShortName: "texteditor.Editor", IDName: "editor", Doc: "Editor is a widget for editing multiple lines of text (as compared to\n[gi.TextField] for a single line). The Editor is driven by a [Buf]\nbuffer which contains all the text, and manages all the edits,\nsending update signals out to the views.\n\nUse SetNeedsRender to drive an render update for any change that does\nnot change the line-level layout of the text.\nUse SetNeedsLayout whenever there are changes across lines that require\nre-layout of the text. This sets the Widget NeedsRender flag and triggers\nlayout during that render.\n\nMultiple views can be attached to a given buffer. All updating in the\nEditor should be within a single goroutine, as it would require\nextensive protections throughout code otherwise.", Directives: gti.Directives{ >i.Directive{Tool: "goki", Directive: "embedder", Args: []string{}}, }, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Buf", >i.Field{Name: "Buf", Type: "*goki.dev/gix/texteditor.Buf", LocalType: "*Buf", Doc: "the text buffer that we're editing", Directives: gti.Directives{}, Tag: "set:\"-\" json:\"-\" xml:\"-\""}}, {"Placeholder", >i.Field{Name: "Placeholder", Type: "string", LocalType: "string", Doc: "text that is displayed when the field is empty, in a lower-contrast manner", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"placeholder\""}}, {"CursorWidth", >i.Field{Name: "CursorWidth", Type: "goki.dev/girl/units.Value", LocalType: "units.Value", Doc: "width of cursor -- set from cursor-width property (inherited)", Directives: gti.Directives{}, Tag: "xml:\"cursor-width\""}}, {"LineNumberColor", >i.Field{Name: "LineNumberColor", Type: "image.Image", LocalType: "image.Image", Doc: "the color used for the side bar containing the line numbers; this should be set in Stylers like all other style properties", Directives: gti.Directives{}, Tag: ""}}, {"SelectColor", >i.Field{Name: "SelectColor", Type: "image.Image", LocalType: "image.Image", Doc: "the color used for the user text selection background color; this should be set in Stylers like all other style properties", Directives: gti.Directives{}, Tag: ""}}, {"HighlightColor", >i.Field{Name: "HighlightColor", Type: "image.Image", LocalType: "image.Image", Doc: "the color used for the text highlight background color (like in find); this should be set in Stylers like all other style properties", Directives: gti.Directives{}, Tag: ""}}, {"CursorColor", >i.Field{Name: "CursorColor", Type: "image.Image", LocalType: "image.Image", Doc: "the color used for the text field cursor (caret); this should be set in Stylers like all other style properties", Directives: gti.Directives{}, Tag: ""}}, {"NLines", >i.Field{Name: "NLines", Type: "int", LocalType: "int", Doc: "number of lines in the view -- sync'd with the Buf after edits, but always reflects storage size of Renders etc", Directives: gti.Directives{}, Tag: "set:\"-\" view:\"-\" json:\"-\" xml:\"-\""}}, {"Renders", >i.Field{Name: "Renders", Type: "[]goki.dev/girl/paint.Text", LocalType: "[]paint.Text", Doc: "renders of the text lines, with one render per line (each line could visibly wrap-around, so these are logical lines, not display lines)", Directives: gti.Directives{}, Tag: "set:\"-\" json:\"-\" xml:\"-\""}}, {"Offs", >i.Field{Name: "Offs", Type: "[]float32", LocalType: "[]float32", Doc: "starting render offsets for top of each line", Directives: gti.Directives{}, Tag: "set:\"-\" view:\"-\" json:\"-\" xml:\"-\""}}, {"LineNoDigs", >i.Field{Name: "LineNoDigs", Type: "int", LocalType: "int", Doc: "number of line number digits needed", Directives: gti.Directives{}, Tag: "set:\"-\" view:\"-\" json:\"-\" xml:\"-\""}}, {"LineNoOff", >i.Field{Name: "LineNoOff", Type: "float32", LocalType: "float32", Doc: "horizontal offset for start of text after line numbers", Directives: gti.Directives{}, Tag: "set:\"-\" view:\"-\" json:\"-\" xml:\"-\""}}, {"LineNoRender", >i.Field{Name: "LineNoRender", Type: "goki.dev/girl/paint.Text", LocalType: "paint.Text", Doc: "render for line numbers", Directives: gti.Directives{}, Tag: "set:\"-\" view:\"-\" json:\"-\" xml:\"-\""}}, {"CursorPos", >i.Field{Name: "CursorPos", Type: "goki.dev/pi/v2/lex.Pos", LocalType: "lex.Pos", Doc: "current cursor position", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}}, {"CursorTarg", >i.Field{Name: "CursorTarg", Type: "goki.dev/pi/v2/lex.Pos", LocalType: "lex.Pos", Doc: "target cursor position for externally-set targets: ensures that it is visible", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}}, {"CursorCol", >i.Field{Name: "CursorCol", Type: "int", LocalType: "int", Doc: "desired cursor column -- where the cursor was last when moved using left / right arrows -- used when doing up / down to not always go to short line columns", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}}, {"PosHistIdx", >i.Field{Name: "PosHistIdx", Type: "int", LocalType: "int", Doc: "current index within PosHistory", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}}, {"SelectStart", >i.Field{Name: "SelectStart", Type: "goki.dev/pi/v2/lex.Pos", LocalType: "lex.Pos", Doc: "starting point for selection -- will either be the start or end of selected region depending on subsequent selection.", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}}, {"SelectReg", >i.Field{Name: "SelectReg", Type: "goki.dev/gix/texteditor/textbuf.Region", LocalType: "textbuf.Region", Doc: "current selection region", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}}, {"PrevSelectReg", >i.Field{Name: "PrevSelectReg", Type: "goki.dev/gix/texteditor/textbuf.Region", LocalType: "textbuf.Region", Doc: "previous selection region, that was actually rendered -- needed to update render", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}}, {"Highlights", >i.Field{Name: "Highlights", Type: "[]goki.dev/gix/texteditor/textbuf.Region", LocalType: "[]textbuf.Region", Doc: "highlighted regions, e.g., for search results", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}}, {"Scopelights", >i.Field{Name: "Scopelights", Type: "[]goki.dev/gix/texteditor/textbuf.Region", LocalType: "[]textbuf.Region", Doc: "highlighted regions, specific to scope markers", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}}, {"SelectMode", >i.Field{Name: "SelectMode", Type: "bool", LocalType: "bool", Doc: "if true, select text as cursor moves", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}}, {"ForceComplete", >i.Field{Name: "ForceComplete", Type: "bool", LocalType: "bool", Doc: "if true, complete regardless of any disqualifying reasons", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}}, {"ISearch", >i.Field{Name: "ISearch", Type: "goki.dev/gix/texteditor.ISearch", LocalType: "ISearch", Doc: "interactive search data", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}}, {"QReplace", >i.Field{Name: "QReplace", Type: "goki.dev/gix/texteditor.QReplace", LocalType: "QReplace", Doc: "query replace data", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}}, {"FontHeight", >i.Field{Name: "FontHeight", Type: "float32", LocalType: "float32", Doc: "font height, cached during styling", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}}, {"LineHeight", >i.Field{Name: "LineHeight", Type: "float32", LocalType: "float32", Doc: "line height, cached during styling", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}}, {"FontAscent", >i.Field{Name: "FontAscent", Type: "float32", LocalType: "float32", Doc: "font ascent, cached during styling", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}}, {"FontDescent", >i.Field{Name: "FontDescent", Type: "float32", LocalType: "float32", Doc: "font descent, cached during styling", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}}, {"NLinesChars", >i.Field{Name: "NLinesChars", Type: "image.Point", LocalType: "image.Point", Doc: "height in lines and width in chars of the visible area", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}}, {"LinesSize", >i.Field{Name: "LinesSize", Type: "goki.dev/mat32/v2.Vec2", LocalType: "mat32.Vec2", Doc: "total size of all lines as rendered", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}}, {"TotalSize", >i.Field{Name: "TotalSize", Type: "goki.dev/mat32/v2.Vec2", LocalType: "mat32.Vec2", Doc: "TotalSize = LinesSize plus extra space and line numbers etc", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}}, {"LineLayoutSize", >i.Field{Name: "LineLayoutSize", Type: "goki.dev/mat32/v2.Vec2", LocalType: "mat32.Vec2", Doc: "LineLayoutSize is Geom.Size.Actual.Total subtracting\nextra space and line numbers -- this is what\nLayoutStdLR sees for laying out each line", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}}, {"BlinkOn", >i.Field{Name: "BlinkOn", Type: "bool", LocalType: "bool", Doc: "oscillates between on and off for blinking", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}}, {"CursorMu", >i.Field{Name: "CursorMu", Type: "sync.Mutex", LocalType: "sync.Mutex", Doc: "mutex protecting cursor rendering -- shared between blink and main code", Directives: gti.Directives{}, Tag: "set:\"-\" json:\"-\" xml:\"-\" view:\"-\""}}, {"HasLinks", >i.Field{Name: "HasLinks", Type: "bool", LocalType: "bool", Doc: "at least one of the renders has links -- determines if we set the cursor for hand movements", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}}, {"LinkHandler", >i.Field{Name: "LinkHandler", Type: "func(tl *goki.dev/girl/paint.TextLink)", LocalType: "func(tl *paint.TextLink)", Doc: "handles link clicks -- if nil, they are sent to the standard web URL handler", Directives: gti.Directives{}, Tag: ""}}, {"lastRecenter", >i.Field{Name: "lastRecenter", Type: "int", LocalType: "int", Doc: "", Directives: gti.Directives{}, Tag: "set:\"-\""}}, {"lastAutoInsert", >i.Field{Name: "lastAutoInsert", Type: "rune", LocalType: "rune", Doc: "", Directives: gti.Directives{}, Tag: "set:\"-\""}}, {"lastFilename", >i.Field{Name: "lastFilename", Type: "goki.dev/gi/v2/gi.FileName", LocalType: "gi.FileName", Doc: "", Directives: gti.Directives{}, Tag: "set:\"-\""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Layout", >i.Field{Name: "Layout", Type: "goki.dev/gi/v2/gi.Layout", LocalType: "gi.Layout", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{ {"Lookup", >i.Method{Name: "Lookup", Doc: "Lookup attempts to lookup symbol at current location, popping up a window\nif something is found", Directives: gti.Directives{ >i.Directive{Tool: "gti", Directive: "add", Args: []string{}}, }, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}}, }), Instance: &Editor{}, })
EditorType is the gti.Type for Editor
var PrevISearchString string
PrevISearchString is the previous ISearch string
var TwinEditorsType = gti.AddType(>i.Type{ Name: "goki.dev/gix/texteditor.TwinEditors", ShortName: "texteditor.TwinEditors", IDName: "twin-editors", Doc: "TwinEditors presents two side-by-side [Editor]s in [gi.Splits]\nthat scroll in sync with each other.", Directives: gti.Directives{}, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"BufA", >i.Field{Name: "BufA", Type: "*goki.dev/gix/texteditor.Buf", LocalType: "*Buf", Doc: "textbuf for A", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\""}}, {"BufB", >i.Field{Name: "BufB", Type: "*goki.dev/gix/texteditor.Buf", LocalType: "*Buf", Doc: "textbuf for B", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Splits", >i.Field{Name: "Splits", Type: "goki.dev/gi/v2/gi.Splits", LocalType: "gi.Splits", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &TwinEditors{}, })
TwinEditorsType is the gti.Type for TwinEditors
var ViewBlinkMu sync.Mutex
ViewBlinkMu is mutex protecting ViewBlink updating and access
var ViewBlinker *time.Ticker
ViewBlinker is the time.Ticker for blinking cursors for text fields, only one of which can be active at at a time
var ViewClipHistChooseLen = 40
ViewClipHistChooseLen is the max length of clip history to show in chooser
var ViewClipHistory [][]byte
ViewClipHistory is the text view clipboard history -- everything that has been copied
var ViewClipRect *textbuf.Edit
ViewClipRect is the internal clipboard for Rect rectangle-based regions -- the raw text is posted on the system clipboard but the rect information is in a special format.
var ViewDepthColors = []color.RGBA{
{0, 0, 0, 0},
{5, 5, 0, 0},
{15, 15, 0, 0},
{5, 15, 0, 0},
{0, 15, 5, 0},
{0, 15, 15, 0},
{0, 5, 15, 0},
{5, 0, 15, 0},
{5, 0, 5, 0},
}
ViewDepthOffsets are changes in color values from default background for different depths. For dark mode, these are increments, for light mode they are decrements.
var ViewMaxFindHighlights = 1000
ViewMaxFindHighlights is the maximum number of regions to highlight on find
var ViewSpriteName = "texteditor.Editor.Cursor"
ViewSpriteName is the name of the window sprite used for the cursor
Functions ¶
func ChromaTagsForLine ¶
ChromaTagsForLine generates the chroma tags for one line of chroma tokens
func ChromaTagsLine ¶
ChromaTagsLine returns tags for one line according to current syntax highlighting settings
func CompleteEditPi ¶
func CompleteEditPi(data any, text string, cursorPos int, comp complete.Completion, seed string) (ed complete.Edit)
CompleteEditPi uses the selected completion to edit the text
func CompletePi ¶
CompletePi uses GoPi symbols and language -- the string is a line of text up to point where user has typed. The data must be the *FileState from which the language type is obtained.
func CompleteText ¶
CompleteText does completion for text files
func CompleteTextEdit ¶
func CompleteTextEdit(data any, text string, cursorPos int, completion complete.Completion, seed string) (ed complete.Edit)
CompleteTextEdit uses the selected completion to edit the text
func HTMLEscapeBytes ¶
HTMLEscapeBytes escapes special characters like "<" to become "<". It escapes only five such characters: <, >, &, ' and ". It operates on a *copy* of the byte string and does not modify the input! otherwise it causes major problems..
func HTMLEscapeRunes ¶
HTMLEscapeRunes escapes special characters like "<" to become "<". It escapes only five such characters: <, >, &, ' and ". It operates on a *copy* of the byte string and does not modify the input! otherwise it causes major problems..
func LookupPi ¶
LookupPi uses GoPi symbols and language -- the string is a line of text up to point where user has typed. The data must be the *FileState from which the language type is obtained.
func ViewClipHistAdd ¶
func ViewClipHistAdd(clip []byte)
ViewClipHistAdd adds the given clipboard bytes to top of history stack
func ViewClipHistChooseList ¶
func ViewClipHistChooseList() []string
ViewClipHistChooseList returns a string slice of length-limited clip history, for chooser
Types ¶
type Buf ¶
type Buf struct { // filename of file last loaded or saved Filename gi.FileName `json:"-" xml:"-"` // Flags are key state flags Flags BufFlags // the current value of the entire text being edited -- using byte slice for greater efficiency Txt []byte `json:"-" xml:"text"` // if true, auto-save file after changes (in a separate routine) Autosave bool // options for how text editing / viewing works Opts textbuf.Opts // full info about file Info fi.FileInfo // Pi parsing state info for file PiState pi.FileStates // syntax highlighting markup parameters (language, style, etc) Hi HiMarkup // number of lines NLines int `json:"-" xml:"-"` // icons for given lines -- use SetLineIcon and DeleteLineIcon LineIcons map[int]icons.Icon // special line number colors given lines -- use SetLineColor and DeleteLineColor LineColors map[int]color.RGBA // icons for each LineIcons being used Icons map[icons.Icon]*gi.Icon `json:"-" xml:"-"` // the live lines of text being edited, with latest modifications -- encoded as runes per line, which is necessary for one-to-one rune / glyph rendering correspondence -- all TextPos positions etc are in *rune* indexes, not byte indexes! Lines [][]rune `json:"-" xml:"-"` // the live lines of text being edited, with latest modifications -- encoded in bytes per line translated from Lines, and used for input to markup -- essential to use Lines and not LineBytes when dealing with TextPos positions, which are in runes LineBytes [][]byte `json:"-" xml:"-"` Tags []lex.Line `json:"extra custom tagged regions for each line"` HiTags []lex.Line `json:"syntax highlighting tags -- auto-generated"` // marked-up version of the edit text lines, after being run through the syntax highlighting process etc -- this is what is actually rendered Markup [][]byte `json:"-" xml:"-"` // edits that have been made since last full markup MarkupEdits []*textbuf.Edit `json:"-" xml:"-"` // offsets for start of each line in Txt byte slice -- this is NOT updated with edits -- call SetByteOffs to set it when needed -- used for re-generating the Txt in LinesToBytes, and set on initial open in BytesToLines ByteOffs []int `json:"-" xml:"-"` // total bytes in document -- see ByteOffs for when it is updated TotalBytes int `json:"-" xml:"-"` // mutex for updating lines LinesMu sync.RWMutex `json:"-" xml:"-"` // mutex for updating markup MarkupMu sync.RWMutex `json:"-" xml:"-"` // markup delay timer MarkupDelayTimer *time.Timer `json:"-" xml:"-"` // mutex for updating markup delay timer MarkupDelayMu sync.Mutex `json:"-" xml:"-"` // the Views that are currently viewing this buffer Views []*Editor `json:"-" xml:"-"` // undo manager Undos textbuf.Undo `json:"-" xml:"-"` // history of cursor positions -- can move back through them PosHistory []lex.Pos `json:"-" xml:"-"` // functions and data for text completion Complete *gi.Complete `json:"-" xml:"-"` // functions and data for spelling correction Spell *gi.Spell `json:"-" xml:"-"` // current text editor -- e.g., the one that initiated Complete or Correct process -- update cursor position in this view -- is reset to nil after usage always CurView *Editor `json:"-" xml:"-"` // supports standard goosi events sending: Change is sent for BufDone, BufInsert, BufDelete Listeners events.Listeners }
Buf is a buffer of text, which can be viewed by View(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. Views 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 are generally signaling, without an explicit Action suffix. Internally, the buffer represents new lines using \n = LF, but saving and loading can deal with Windows/DOS CRLF format.
func (*Buf) AddTagEdit ¶
AddTagEdit adds a new custom tag for given line, using textbuf.Edit for location
func (*Buf) AdjustPos ¶
AdjustPos adjusts given text position, which was recorded at given time for any edits that have taken place since that time (using the Undo stack). del determines what to do with positions within a deleted region -- either move to start or end of the region, or return an error
func (*Buf) AdjustReg ¶
AdjustReg adjusts given text region for any edits that have taken place since time stamp on region (using the Undo stack). If region was wholly within a deleted region, then RegionNil will be returned -- otherwise it is clipped appropriately as function of deletes.
func (*Buf) AdjustedTags ¶
AdjustedTags updates tag positions for edits must be called under MarkupMu lock
func (*Buf) AdjustedTagsImpl ¶
AdjustedTagsImpl updates tag positions for edits, for given list of tags
func (*Buf) AppendText ¶
AppendText appends new text to end of buffer, using insert, returns edit
func (*Buf) AppendTextLine ¶
AppendTextLine 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. Returns the edit region.
func (*Buf) AppendTextLineMarkup ¶
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 (*Buf) AppendTextMarkup ¶
AppendTextMarkup appends new text to end of buffer, using insert, returns edit, and uses supplied markup to render it
func (*Buf) AutoIndent ¶
AutoIndent indents given line to the level of the prior line, adjusted appropriately if the current line starts with one of the given un-indent strings, or the prior line ends with one of the given indent strings. Returns any edit that took place (could be nil), along with the auto-indented level and character position for the indent of the current line.
func (*Buf) AutoIndentRegion ¶
AutoIndentRegion does auto-indent over given region -- end is *exclusive*
func (*Buf) AutoSaveCheck ¶
AutoSaveCheck checks if an autosave file exists -- logic for dealing with it is left to larger app -- call this before opening a file
func (*Buf) AutoSaveDelete ¶
func (tb *Buf) AutoSaveDelete()
AutoSaveDelete deletes any existing autosave file
func (*Buf) AutoSaveFilename ¶
AutoSaveFilename returns the autosave filename
func (*Buf) AutoSaveOff ¶
AutoSaveOff turns off autosave and returns the prior state of Autosave flag. Call AutoSaveRestore with rval when done. See BatchUpdate methods for auto-use of this.
func (*Buf) AutoSaveRestore ¶
AutoSaveRestore restores prior Autosave setting, from AutoSaveOff
func (*Buf) AutoScrollViews ¶
func (tb *Buf) AutoScrollViews()
AutoscrollViews ensures that views are always viewing the end of the buffer
func (*Buf) BatchUpdateEnd ¶
BatchUpdateEnd call to complete BatchUpdateStart
func (*Buf) BatchUpdateStart ¶
BatchUpdateStart call this when starting a batch of updates. It calls AutoSaveOff and returns the prior state of that flag which must be restored using BatchUpdateEnd.
func (*Buf) BraceMatch ¶
BraceMatch finds the brace, bracket, or parens that is the partner of the one passed to function.
func (*Buf) BytesToLines ¶
func (tb *Buf) BytesToLines()
BytesToLines converts current Txt bytes into lines, and initializes markup with raw text
func (*Buf) ClearNotSaved ¶
func (tb *Buf) ClearNotSaved()
ClearNotSaved resets the BufNotSaved flag, and also calls ClearChanged
func (*Buf) Close ¶
Close closes the buffer -- prompts to save if changes, and disconnects from views if afterFun is non-nil, then it is called with the status of the user action
func (*Buf) CommentRegion ¶
CommentRegion inserts comment marker on given lines -- end is *exclusive*
func (*Buf) CommentStart ¶
CommentStart returns the char index where the comment starts on given line, -1 if no comment
func (*Buf) CompleteExtend ¶
CompleteExtend inserts the extended seed at the current cursor position
func (*Buf) CompleteText ¶
CompleteText edits the text using the string chosen from the completion menu
func (*Buf) ConfigKnown ¶
ConfigKnown configures options based on the supported language info in GoPi returns true if supported
func (*Buf) CorrectClear ¶
CorrectClear clears the TextSpellErr tag for given word
func (*Buf) CorrectText ¶
CorrectText edits the text using the string chosen from the correction menu
func (*Buf) DeleteCompleter ¶
func (tb *Buf) DeleteCompleter()
func (*Buf) DeleteLineIcon ¶
DeleteLineIcon deletes any icon at given line (0 starting) if ln = -1 then delete all line icons.
func (*Buf) DeleteSpell ¶
func (tb *Buf) DeleteSpell()
DeleteSpell deletes any existing spell object
func (*Buf) DeleteText ¶
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 (*Buf) DeleteTextImpl ¶
DeleteTextImpl deletes region of text between start and end positions. Sets the timestamp on resulting textbuf.Edit to now. Must be called under LinesMu.Lock.
func (*Buf) DeleteTextRect ¶
DeleteTextRect deletes rectangular region of text between start, end defining the upper-left and lower-right corners of a rectangle. Fails if st.Ch >= ed.Ch. Sets the timestamp on resulting textbuf.Edit to now. An Undo record is automatically saved depending on Undo.Off setting.
func (*Buf) DeleteTextRectImpl ¶
DeleteTextRectImpl deletes rectangular region of text between start, end defining the upper-left and lower-right corners of a rectangle. Fails if st.Ch >= ed.Ch. Sets the timestamp on resulting textbuf.Edit to now. Must be called under LinesMu.Lock.
func (*Buf) DeleteView ¶
DeleteView removes given viewer from our buffer
func (*Buf) DiffBufs ¶
DiffBufs computes the diff between this buffer and the other buffer, reporting a sequence of operations that would convert this buffer (a) into the other buffer (b). Each operation is either an 'r' (replace), 'd' (delete), 'i' (insert) or 'e' (equal). Everything is line-based (0, offset).
func (*Buf) DiffBufsUnified ¶
DiffBufsUnified 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 (*Buf) EditDone ¶
func (tb *Buf) EditDone()
EditDone finalizes any current editing, sends signal
func (*Buf) EmacsUndoSave ¶
func (tb *Buf) EmacsUndoSave()
EmacsUndoSave is called by View at end of latest set of undo commands. If EmacsUndo mode is active, saves the current UndoStack to the regular Undo stack at the end, and moves undo to the very end -- undo is a constant stream.
func (*Buf) FileModCheck ¶
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. returns true if file was modified
func (*Buf) FlagType ¶
func (tb *Buf) FlagType() enums.BitFlagSetter
func (*Buf) HasLineColor ¶
HasLineColor checks if given line has a line color set
func (*Buf) HiTagAtPos ¶
HiTagAtPos returns the highlighting (markup) lexical tag at given position using current Markup tags, and index, -- could be nil if none or out of range
func (*Buf) InComment ¶
InComment returns true if the given text position is within a commented region
func (*Buf) InLitString ¶
InLitString returns true if position is in a string literal
func (*Buf) InTokenCode ¶
InTokenCode returns true if position is in a Keyword, Name, Operator, or Punctuation. This is useful for turning off spell checking in docs
func (*Buf) InTokenSubCat ¶
InTokenSubCat returns true if the given text position is marked with lexical type in given SubCat sub-category
func (*Buf) IndentLine ¶
IndentLine indents line by given number of tab stops, using tabs or spaces, for given tab size (if using spaces) -- either inserts or deletes to reach target. Returns edit record for any change.
func (*Buf) InitialMarkup ¶
func (tb *Buf) InitialMarkup()
InitialMarkup does the first-pass markup on the file
func (*Buf) InsertText ¶
InsertText is the primary method for inserting text into the buffer. It inserts new text at given starting position, optionally signaling views after text has been inserted. Sets the timestamp on resulting Edit to now. An Undo record is automatically saved depending on Undo.Off setting.
func (*Buf) InsertTextImpl ¶
InsertTextImpl does the raw insert of new text at given starting position, returning a new Edit with timestamp of Now. LinesMu must be locked surrounding this call.
func (*Buf) InsertTextRect ¶
InsertTextRect inserts a rectangle of text defined in given textbuf.Edit record, (e.g., from RegionRect or DeleteRect), optionally signaling views after text has been inserted. Returns a copy of the Edit record with an updated timestamp. An Undo record is automatically saved depending on Undo.Off setting.
func (*Buf) InsertTextRectImpl ¶
InsertTextRectImpl does the raw insert of new text at given starting position, using a Rect textbuf.Edit (e.g., from RegionRect or DeleteRect). Returns a copy of the Edit record with an updated timestamp.
func (*Buf) IsChanged ¶
IsChanged indicates if the text has been changed (edited) relative to the original, since last EditDone
func (*Buf) IsMarkingUp ¶
IsMarkingUp is true if the MarkupAllLines process is currently running
func (*Buf) IsNotSaved ¶
IsNotSaved indicates if the text has been changed (edited) relative to the original, since last Save
func (*Buf) IsSpellEnabled ¶
IsSpellEnabled returns true if spelling correction is enabled, taking into account given position in text if it is relevant for cases where it is only conditionally enabled
func (*Buf) IsValidLine ¶
IsValidLine returns true if given line is in range
func (*Buf) JoinParaLines ¶
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 -- edLn is *inclusive*
func (*Buf) LexObjPathString ¶
LexObjPathString returns the string at given lex, and including prior lex-tagged regions that include sequences of PunctSepPeriod and NameTag which are used for object paths -- used for e.g., debugger to pull out variable expressions that can be evaluated.
func (*Buf) LineCommented ¶
LineCommented returns true if the given line is a full-comment line (i.e., starts with a comment)
func (*Buf) LineLen ¶
LineLen is the concurrent-safe accessor to length of specific Line of Lines runes
func (*Buf) LinesDeleted ¶
LinesDeleted deletes lines in Markup corresponding to lines deleted in Lines text. Locks and unlocks the Markup mutex, and must be called under lines mutex.
func (*Buf) LinesEdited ¶
LinesEdited re-marks-up lines in edit (typically only 1). Locks and unlocks the Markup mutex. Must be called under Lines mutex lock.
func (*Buf) LinesInserted ¶
LinesInserted inserts new lines in Markup corresponding to lines inserted in Lines text. Locks and unlocks the Markup mutex, and must be called under lines mutex
func (*Buf) LinesToBytes ¶
func (tb *Buf) LinesToBytes()
LinesToBytes converts current Lines back to the Txt slice of bytes.
func (*Buf) LinesToBytesCopy ¶
LinesToBytesCopy converts current Lines into a separate text byte copy -- e.g., for autosave or other "offline" uses of the text -- doesn't affect byte offsets etc
func (*Buf) MarkupAllLines ¶
MarkupAllLines does syntax highlighting markup for all lines in buffer, calling MarkupMu mutex when setting the marked-up lines with the result -- designed to be called in a separate goroutine. if maxLines > 0 then it specifies a maximum number of lines (for InitialMarkup)
func (*Buf) MarkupFromTags ¶
func (tb *Buf) MarkupFromTags()
MarkupFromTags does syntax highlighting markup using existing HiTags without running new tagging -- for special case where tagging is under external control
func (*Buf) MarkupLines ¶
MarkupLines generates markup of given range of lines. end is *inclusive* line. returns true if all lines were marked up successfully. This does NOT lock the MarkupMu mutex (done at outer loop)
func (*Buf) MarkupLinesLock ¶
MarkupLinesLock does MarkupLines and gets the mutex lock first
func (*Buf) OnChange ¶
OnChange adds an event listener function for the events.Change event
func (*Buf) OnInput ¶
OnInput adds an event listener function for the events.Input event
func (*Buf) OpenFile ¶
OpenFile just loads a file into the buffer -- doesn't do any markup or notification -- for temp bufs
func (*Buf) PatchFromBuf ¶
PatchFromBuf patches (edits) this buffer using content from other buffer, according to diff operations (e.g., as generated from DiffBufs). signal determines whether each patch is signaled -- if an overall signal will be sent at the end, then that would not be necessary (typical)
func (*Buf) Redo ¶
Redo redoes next group of items on the undo stack, and returns the last record, nil if no more
func (*Buf) Region ¶
Region returns a textbuf.Edit representation of text between start and end positions returns nil if not a valid region. sets the timestamp on the textbuf.Edit to now
func (*Buf) RegionImpl ¶
RegionImpl returns a textbuf.Edit representation of text between start and end positions. Returns nil if not a valid region. Sets the timestamp on the textbuf.Edit to now. Impl version must be called under LinesMu.RLock or Lock
func (*Buf) RegionRect ¶
RegionRect returns a textbuf.Edit representation of text between start and end positions as a rectangle, returns nil if not a valid region. sets the timestamp on the textbuf.Edit to now
func (*Buf) RegionRectImpl ¶
RegionRectImpl returns a textbuf.Edit representation of rectangle of text between start (upper left) and end (bottom right) positions. Returns nil if not a valid region. All lines in Text are guaranteed to be of the same size, even if line had fewer chars. Sets the timestamp on the textbuf.Edit to now. Impl version must be called under LinesMu.RLock or Lock
func (*Buf) RemoveTag ¶
RemoveTag removes tag (optionally only given tag if non-zero) at given position if it exists -- returns tag
func (*Buf) ReplaceText ¶
func (tb *Buf) ReplaceText(delSt, delEd, insPos lex.Pos, insTxt string, signal, matchCase bool) *textbuf.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 lex.MatchCase function is called to match the case (upper / lower) of the new inserted text to that of the text being replaced. returns the textbuf.Edit for the inserted text.
func (*Buf) Revert ¶
Revert re-opens text from current file, if filename set -- returns false if not -- uses an optimized diff-based update to preserve existing formatting -- very fast if not very different
func (*Buf) SaveAs ¶
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 (*Buf) SaveAsFunc ¶
SaveAsFunc 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. If afterFunc is non-nil, then it is called with the status of the user action.
func (*Buf) SavePosHistory ¶
SavePosHistory saves the cursor position in history stack of cursor positions -- tracks across views -- returns false if position was on same line as last one saved
func (*Buf) SceneFromView ¶
SceneFromView returns Scene from text editor, if avail
func (*Buf) Search ¶
Search looks for a string (no regexp) within buffer, with given case-sensitivity, returning number of occurrences and specific match position list. column positions are in runes.
func (*Buf) SearchRegexp ¶
SearchRegexp looks for a string (regexp) within buffer, returning number of occurrences and specific match position list. Column positions are in runes.
func (*Buf) SetByteOffs ¶
func (tb *Buf) SetByteOffs()
SetByteOffs sets the byte offsets for each line into the raw text
func (*Buf) SetCompleter ¶
func (tb *Buf) SetCompleter(data any, matchFun complete.MatchFunc, editFun complete.EditFunc, lookupFun complete.LookupFunc)
SetCompleter sets completion functions so that completions will automatically be offered as the user types
func (*Buf) SetFilename ¶
func (*Buf) SetHiStyle ¶
func (tb *Buf) SetHiStyle(style gi.HiStyleName) *Buf
SetHiStyle sets the highlighting style -- needs to be protected by mutex
func (*Buf) SetLineColor ¶
SetLineColor sets given color at given line (0 starting)
func (*Buf) SetLineIcon ¶
SetLineIcon sets given icon at given line (0 starting)
func (*Buf) SetReadOnly ¶
SetReadOnly sets the buffer in a ReadOnly state if readonly = true otherwise is in editable state.
func (*Buf) SetSpell ¶
func (tb *Buf) SetSpell()
SetSpell sets spell correct functions so that spell correct will automatically be offered as the user types
func (*Buf) SetTextLines ¶
SetTextLines sets the text to given lines of bytes if cpy is true, make a copy of bytes -- otherwise use
func (*Buf) SignalMods ¶
func (tb *Buf) SignalMods()
SignalMods sends the BufMods signal for misc, potentially widespread modifications to buffer.
func (*Buf) SignalViews ¶
func (tb *Buf) SignalViews(sig BufSignals, edit *textbuf.Edit)
SignalViews sends the given signal and optional edit info to all the Views for this Buf
func (*Buf) SpacesToTabs ¶
SpacesToTabs replaces spaces with tabs in given line.
func (*Buf) SpacesToTabsRegion ¶
SpacesToTabsRegion replaces tabs with spaces over given region -- end is *exclusive*
func (*Buf) SpellCheckLineErrs ¶
SpellCheckLineErrs runs spell check on given line, and returns Lex tags with token.TextSpellErr for any misspelled words
func (*Buf) SpellCheckLineTag ¶
SpellCheckLineTag runs spell check on given line, and sets Tags for any misspelled words and updates markup for that line.
func (*Buf) StartDelayedReMarkup ¶
func (tb *Buf) StartDelayedReMarkup()
StartDelayedReMarkup starts a timer for doing markup after an interval
func (*Buf) StopDelayedReMarkup ¶
func (tb *Buf) StopDelayedReMarkup()
StopDelayedReMarkup stops timer for doing markup after an interval
func (*Buf) Strings ¶
Strings returns the current text as []string array. If addNewLn is true, each string line has a \n appended at end.
func (*Buf) TabsToSpaces ¶
TabsToSpaces replaces tabs with spaces in given line.
func (*Buf) TabsToSpacesRegion ¶
TabsToSpacesRegion replaces tabs with spaces over given region -- end is *exclusive*
func (*Buf) Text ¶
Text returns the current text as a []byte array, applying all current changes -- calls EditDone and will generate that signal if there have been changes
type BufFlags ¶
type BufFlags gi.WidgetFlags //enums:bitflag -trim-prefix Buf
BufFlags hold key Buf state
const ( // BufAutoSaving is used in atomically safe way to protect autosaving BufAutoSaving BufFlags = BufFlags(gi.WidgetFlagsN) + iota // BufMarkingUp indicates current markup operation in progress -- don't redo BufMarkingUp // BufChanged indicates if the text has been changed (edited) relative to the // original, since last EditDone BufChanged // BufNotSaved indicates if the text has been changed (edited) relative to the // original, since last Save BufNotSaved // BufFileModOk have already asked about fact that file has changed since being // opened, user is ok BufFileModOk )
const BufFlagsN BufFlags = 13
BufFlagsN is the highest valid value for type BufFlags, plus one.
func BufFlagsValues ¶
func BufFlagsValues() []BufFlags
BufFlagsValues returns all possible values for the type BufFlags.
func (BufFlags) BitIndexString ¶
BitIndexString returns the string representation of this BufFlags value if it is a bit index value (typically an enum constant), and not an actual bit flag value.
func (BufFlags) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*BufFlags) SetFlag ¶
SetFlag sets the value of the given flags in these flags to the given value.
func (*BufFlags) SetString ¶
SetString sets the BufFlags value from its string representation, and returns an error if the string is invalid.
func (*BufFlags) SetStringOr ¶
SetStringOr sets the BufFlags value from its string representation while preserving any bit flags already set, and returns an error if the string is invalid.
func (*BufFlags) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type BufList ¶
type BufList []*Buf
BufList is a slice list of text buffers
var Bufs BufList
Bufs is the default list of Buf buffers for open texts
type BufSignals ¶
type BufSignals int32 //enums:enum
BufSignals are signals that text buffer can send to View
const ( // BufDone means that editing was completed and applied to Txt field // -- data is Txt bytes BufDone BufSignals = iota // BufNew signals that entirely new text is present. // All views should do full layout update. BufNew // BufMods signals that potentially diffuse modifications // have been made. Views should do a Layout and Render. BufMods // BufInsert signals that some text was inserted. // data is textbuf.Edit describing change. // The Buf always reflects the current state *after* the edit. BufInsert // BufDelete signals that some text was deleted. // data is textbuf.Edit describing change. // The Buf always reflects the current state *after* the edit. BufDelete // BufMarkUpdt signals that the Markup text has been updated // This signal is typically sent from a separate goroutine, // so should be used with a mutex BufMarkUpdt // BufClosed signals that the textbuf was closed. BufClosed )
const BufSignalsN BufSignals = 7
BufSignalsN is the highest valid value for type BufSignals, plus one.
func BufSignalsValues ¶
func BufSignalsValues() []BufSignals
BufSignalsValues returns all possible values for the type BufSignals.
func (BufSignals) Desc ¶
func (i BufSignals) Desc() string
Desc returns the description of the BufSignals value.
func (BufSignals) Int64 ¶
func (i BufSignals) Int64() int64
Int64 returns the BufSignals value as an int64.
func (BufSignals) IsValid ¶
func (i BufSignals) IsValid() bool
IsValid returns whether the value is a valid option for type BufSignals.
func (BufSignals) MarshalText ¶
func (i BufSignals) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (*BufSignals) SetInt64 ¶
func (i *BufSignals) SetInt64(in int64)
SetInt64 sets the BufSignals value from an int64.
func (*BufSignals) SetString ¶
func (i *BufSignals) SetString(s string) error
SetString sets the BufSignals value from its string representation, and returns an error if the string is invalid.
func (BufSignals) String ¶
func (i BufSignals) String() string
String returns the string representation of this BufSignals value.
func (*BufSignals) UnmarshalText ¶
func (i *BufSignals) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (BufSignals) Values ¶
func (i BufSignals) Values() []enums.Enum
Values returns all possible values for the type BufSignals.
type DiffTextEditor ¶
type DiffTextEditor struct {
Editor
}
DiffTextEditor supports double-click based application of edits from one buffer to the other.
func NewDiffTextEditor ¶
func NewDiffTextEditor(par ki.Ki, name ...string) *DiffTextEditor
NewDiffTextEditor adds a new DiffTextEditor with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*DiffTextEditor) DiffView ¶
func (tv *DiffTextEditor) DiffView() *DiffView
func (*DiffTextEditor) HandleDoubleClick ¶
func (tv *DiffTextEditor) HandleDoubleClick()
func (*DiffTextEditor) KiType ¶
func (t *DiffTextEditor) KiType() *gti.Type
KiType returns the *gti.Type of DiffTextEditor
func (*DiffTextEditor) New ¶
func (t *DiffTextEditor) New() ki.Ki
New returns a new *DiffTextEditor value
func (*DiffTextEditor) OnInit ¶
func (tv *DiffTextEditor) OnInit()
func (*DiffTextEditor) SetCursorColor ¶
func (t *DiffTextEditor) SetCursorColor(v image.Image) *DiffTextEditor
SetCursorColor sets the [DiffTextEditor.CursorColor]
func (*DiffTextEditor) SetCursorWidth ¶
func (t *DiffTextEditor) SetCursorWidth(v units.Value) *DiffTextEditor
SetCursorWidth sets the [DiffTextEditor.CursorWidth]
func (*DiffTextEditor) SetHighlightColor ¶
func (t *DiffTextEditor) SetHighlightColor(v image.Image) *DiffTextEditor
SetHighlightColor sets the [DiffTextEditor.HighlightColor]
func (*DiffTextEditor) SetLineNumberColor ¶
func (t *DiffTextEditor) SetLineNumberColor(v image.Image) *DiffTextEditor
SetLineNumberColor sets the [DiffTextEditor.LineNumberColor]
func (*DiffTextEditor) SetLinkHandler ¶
func (t *DiffTextEditor) SetLinkHandler(v func(tl *paint.TextLink)) *DiffTextEditor
SetLinkHandler sets the [DiffTextEditor.LinkHandler]
func (*DiffTextEditor) SetPlaceholder ¶
func (t *DiffTextEditor) SetPlaceholder(v string) *DiffTextEditor
SetPlaceholder sets the [DiffTextEditor.Placeholder]
func (*DiffTextEditor) SetSelectColor ¶
func (t *DiffTextEditor) SetSelectColor(v image.Image) *DiffTextEditor
SetSelectColor sets the [DiffTextEditor.SelectColor]
func (*DiffTextEditor) SetStackTop ¶
func (t *DiffTextEditor) SetStackTop(v int) *DiffTextEditor
SetStackTop sets the [DiffTextEditor.StackTop]
func (*DiffTextEditor) SetTooltip ¶
func (t *DiffTextEditor) SetTooltip(v string) *DiffTextEditor
SetTooltip sets the [DiffTextEditor.Tooltip]
type DiffView ¶
type DiffView struct { gi.Frame // first file name being compared FileA string // second file name being compared FileB string // revision for first file, if relevant RevA string // revision for second file, if relevant RevB string // textbuf for A showing the aligned edit view BufA *Buf `json:"-" xml:"-" set:"-"` // textbuf for B showing the aligned edit view BufB *Buf `json:"-" xml:"-" set:"-"` // aligned diffs records diff for aligned lines AlignD textbuf.Diffs `json:"-" xml:"-" set:"-"` // Diffs applied Diffs textbuf.DiffSelected }
DiffView presents two side-by-side TextEditor windows showing the differences between two files (represented as lines of strings).
func DiffFiles ¶
DiffFiles shows the diffs between this file as the A file, and other file as B file, in a DiffViewDialog
func DiffViewDialog ¶
func DiffViewDialog(ctx gi.Widget, title string, astr, bstr []string, afile, bfile, arev, brev string) *DiffView
DiffViewDialog opens a dialog for displaying diff between two files as line-strings
func DiffViewDialogFromRevs ¶
func DiffViewDialogFromRevs(ctx gi.Widget, repo vci.Repo, file string, fbuf *Buf, rev_a, rev_b string) (*DiffView, error)
DiffViewDialogFromRevs 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 NewDiffView ¶
NewDiffView adds a new DiffView with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*DiffView) ApplyDiff ¶
ApplyDiff applies change from the other buffer to the buffer for given file name, from diff that includes given line.
func (*DiffView) ConfigDiffView ¶
func (dv *DiffView) ConfigDiffView()
func (*DiffView) ConfigToolbar ¶
ConfigToolbar configures a gi.Toolbar for this view
func (*DiffView) ConfigWidget ¶
func (dv *DiffView) ConfigWidget()
func (*DiffView) DiffStrings ¶
DiffStrings computes differences between two lines-of-strings and displays in DiffView.
func (*DiffView) SaveAs ¶
SaveAs saves A or B edits into given file. It checks for an existing file, prompts to overwrite or not.
func (*DiffView) SetDiffs ¶
func (t *DiffView) SetDiffs(v textbuf.DiffSelected) *DiffView
SetDiffs sets the [DiffView.Diffs]: Diffs applied
func (*DiffView) SetStackTop ¶
SetStackTop sets the [DiffView.StackTop]
func (*DiffView) SetStripes ¶
SetStripes sets the [DiffView.Stripes]
func (*DiffView) SetTooltip ¶
SetTooltip sets the [DiffView.Tooltip]
func (*DiffView) TagWordDiffs ¶
func (dv *DiffView) TagWordDiffs()
TagWordDiffs goes through replace diffs and tags differences at the word level between the two regions.
func (*DiffView) TextEditors ¶
func (dv *DiffView) TextEditors() (*DiffTextEditor, *DiffTextEditor)
type Editor ¶
type Editor struct { gi.Layout // the text buffer that we're editing Buf *Buf `set:"-" json:"-" xml:"-"` // text that is displayed when the field is empty, in a lower-contrast manner Placeholder string `json:"-" xml:"placeholder"` // width of cursor -- set from cursor-width property (inherited) CursorWidth units.Value `xml:"cursor-width"` // 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 // the color used for the user text selection background color; this should be set in Stylers like all other style properties SelectColor image.Image // 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 // the color used for the text field cursor (caret); this should be set in Stylers like all other style properties CursorColor image.Image // number of lines in the view -- sync'd with the Buf after edits, but always reflects storage size of Renders etc NLines int `set:"-" view:"-" json:"-" xml:"-"` // renders of the text lines, with one render per line (each line could visibly wrap-around, so these are logical lines, not display lines) Renders []paint.Text `set:"-" json:"-" xml:"-"` // starting render offsets for top of each line Offs []float32 `set:"-" view:"-" json:"-" xml:"-"` // number of line number digits needed LineNoDigs int `set:"-" view:"-" json:"-" xml:"-"` // horizontal offset for start of text after line numbers LineNoOff float32 `set:"-" view:"-" json:"-" xml:"-"` // render for line numbers LineNoRender paint.Text `set:"-" view:"-" json:"-" xml:"-"` // current cursor position CursorPos lex.Pos `set:"-" edit:"-" json:"-" xml:"-"` // target cursor position for externally-set targets: ensures that it is visible CursorTarg lex.Pos `set:"-" edit:"-" json:"-" xml:"-"` // desired cursor column -- where the cursor was last when moved using left / right arrows -- used when doing up / down to not always go to short line columns CursorCol int `set:"-" edit:"-" json:"-" xml:"-"` // current index within PosHistory PosHistIdx int `set:"-" edit:"-" json:"-" xml:"-"` // starting point for selection -- will either be the start or end of selected region depending on subsequent selection. SelectStart lex.Pos `set:"-" edit:"-" json:"-" xml:"-"` // current selection region SelectReg textbuf.Region `set:"-" edit:"-" json:"-" xml:"-"` // previous selection region, that was actually rendered -- needed to update render PrevSelectReg textbuf.Region `set:"-" edit:"-" json:"-" xml:"-"` // highlighted regions, e.g., for search results Highlights []textbuf.Region `set:"-" edit:"-" json:"-" xml:"-"` // highlighted regions, specific to scope markers Scopelights []textbuf.Region `set:"-" edit:"-" json:"-" xml:"-"` // if true, select text as cursor moves SelectMode bool `set:"-" edit:"-" json:"-" xml:"-"` // if true, complete regardless of any disqualifying reasons ForceComplete bool `set:"-" edit:"-" json:"-" xml:"-"` // interactive search data ISearch ISearch `set:"-" edit:"-" json:"-" xml:"-"` // query replace data QReplace QReplace `set:"-" edit:"-" json:"-" xml:"-"` // font height, cached during styling FontHeight float32 `set:"-" edit:"-" json:"-" xml:"-"` // line height, cached during styling LineHeight float32 `set:"-" edit:"-" json:"-" xml:"-"` // font ascent, cached during styling FontAscent float32 `set:"-" edit:"-" json:"-" xml:"-"` // font descent, cached during styling FontDescent float32 `set:"-" edit:"-" json:"-" xml:"-"` // height in lines and width in chars of the visible area NLinesChars image.Point `set:"-" edit:"-" json:"-" xml:"-"` // total size of all lines as rendered LinesSize mat32.Vec2 `set:"-" edit:"-" json:"-" xml:"-"` // TotalSize = LinesSize plus extra space and line numbers etc TotalSize mat32.Vec2 `set:"-" edit:"-" json:"-" xml:"-"` // LineLayoutSize is Geom.Size.Actual.Total subtracting // extra space and line numbers -- this is what // LayoutStdLR sees for laying out each line LineLayoutSize mat32.Vec2 `set:"-" edit:"-" json:"-" xml:"-"` // oscillates between on and off for blinking BlinkOn bool `set:"-" edit:"-" json:"-" xml:"-"` // mutex protecting cursor rendering -- shared between blink and main code CursorMu sync.Mutex `set:"-" json:"-" xml:"-" view:"-"` // at least one of the renders has links -- determines if we set the cursor for hand movements HasLinks bool `set:"-" edit:"-" json:"-" xml:"-"` // handles link clicks -- if nil, they are sent to the standard web URL handler LinkHandler func(tl *paint.TextLink) // contains filtered or unexported fields }
Editor is a widget for editing multiple lines of text (as compared to gi.TextField for a single line). The Editor is driven by a Buf buffer which contains all the text, and manages all the edits, sending update signals out to the views.
Use SetNeedsRender to drive an render update for any change that does not change the line-level layout of the text. Use SetNeedsLayout 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 views 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.
var BlinkingView *Editor
BlinkingView is the text field that is blinking
func AsEditor ¶
func AsEditor(k ki.Ki) *Editor
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 adds a new Editor with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func NewViewLayout ¶
NewViewLayout adds a new layout with text editor to given parent node, with given name. Layout adds "-lay" suffix. Texediew should always have a parent Layout to manage the scrollbars.
func TextDialog ¶
TextDialog opens a dialog for displaying text string
func (*Editor) ApplyStyle ¶
func (ed *Editor) ApplyStyle()
ApplyStyle calls StyleView and sets the style
func (*Editor) AsEditor ¶
AsEditor satisfies the EditorEmbedder interface
func (*Editor) BufSignal ¶
func (ed *Editor) BufSignal(sig BufSignals, tbe *textbuf.Edit)
BufSignal receives a signal from the Buf when underlying text is changed.
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) CancelCorrect ¶
func (ed *Editor) CancelCorrect()
CancelCorrect cancels any pending spell correction -- call this when new events have moved beyond any prior correction scenario
func (*Editor) CharEndPos ¶
CharEndPos returns the ending (bottom right) render coords for the given position -- makes no attempt to rationalize that pos (i.e., if not in visible range, position will be out of range too)
func (*Editor) CharStartPos ¶
CharStartPos returns the starting (top left) render coords for the given position -- makes no attempt to rationalize that pos (i.e., if not in visible range, position will be out of range too)
func (*Editor) CharStartPosVis ¶
CharStartPosVis returns the starting pos for given position that is currently visible, based on bounding boxes.
func (*Editor) Clear ¶
func (ed *Editor) Clear()
Clear resets all the text in the buffer for this view
func (*Editor) ClearHighlights ¶
func (ed *Editor) ClearHighlights()
ClearHighlights clears the Highlights slice of all regions
func (*Editor) ClearScopelights ¶
func (ed *Editor) ClearScopelights()
ClearScopelights clears the Highlights slice of all regions
func (*Editor) ClearSelected ¶
func (ed *Editor) ClearSelected()
ClearSelected resets both the global selected flag and any current selection
func (*Editor) ConfigWidget ¶
func (ed *Editor) ConfigWidget()
func (*Editor) ContextMenu ¶
ContextMenu builds the text editor context menu
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) CursorBBox ¶
CursorBBox returns a bounding-box for a cursor at given position
func (*Editor) CursorBackspace ¶
CursorBackspace deletes character(s) immediately before cursor
func (*Editor) CursorBackspaceWord ¶
CursorBackspaceWord deletes words(s) immediately before cursor
func (*Editor) CursorBackward ¶
CursorBackward moves the cursor backward
func (*Editor) CursorBackwardWord ¶
CursorBackwardWord moves the cursor backward by words
func (*Editor) CursorDelete ¶
CursorDelete deletes character(s) immediately after the cursor
func (*Editor) CursorDeleteWord ¶
CursorDeleteWord deletes word(s) immediately after the cursor
func (*Editor) CursorDown ¶
CursorDown moves the cursor down line(s)
func (*Editor) CursorEndDoc ¶
func (ed *Editor) CursorEndDoc()
CursorEndDoc moves the cursor to the end of the text, updating selection if select mode is active
func (*Editor) CursorEndLine ¶
func (ed *Editor) CursorEndLine()
CursorEndLine moves the cursor to the end of the text
func (*Editor) CursorForward ¶
CursorForward moves the cursor forward
func (*Editor) CursorForwardWord ¶
CursorForwardWord moves the cursor forward by words
func (*Editor) CursorKill ¶
func (ed *Editor) CursorKill()
CursorKill deletes text from cursor to end of text
func (*Editor) CursorMovedSig ¶
func (ed *Editor) CursorMovedSig()
CursorMovedSig sends the signal that cursor has moved
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) CursorPageDown ¶
CursorPageDown moves the cursor down page(s), where a page is defined abcdef dynamically as just moving the cursor off the screen
func (*Editor) CursorPageUp ¶
CursorPageUp moves the cursor up page(s), where a page is defined dynamically as just moving the cursor off the screen
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) CursorRecenter ¶
func (ed *Editor) CursorRecenter()
CursorRecenter re-centers the view around the cursor position, toggling between putting cursor in middle, top, and bottom of view
func (*Editor) CursorSelect ¶
CursorSelect updates selection based on cursor movements, given starting cursor position and ed.CursorPos is current
func (*Editor) CursorSprite ¶
CursorSprite returns the sprite for the cursor, which is only rendered once with a vertical bar, and just activated and inactivated depending on render status.
func (*Editor) CursorSpriteName ¶
CursorSpriteName returns the name of the cursor sprite
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) CursorStartLine ¶
func (ed *Editor) CursorStartLine()
CursorStartLine moves the cursor to the start of the line, updating selection if select mode is active
func (*Editor) CursorToHistNext ¶
CursorToHistNext moves cursor to previous position on history list -- returns true if moved
func (*Editor) CursorToHistPrev ¶
CursorToHistPrev moves cursor to previous position on history list -- returns true if moved
func (*Editor) CursorTranspose ¶
func (ed *Editor) CursorTranspose()
CursorTranspose swaps the character at the cursor with the one before it
func (*Editor) CursorTransposeWord ¶
func (ed *Editor) CursorTransposeWord()
CursorTranspose swaps the word at the cursor with the one before it
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) DeleteSelection ¶
DeleteSelection deletes any selected text, without adding to clipboard -- returns text deleted as textbuf.Edit (nil if none)
func (*Editor) EditDone ¶
func (ed *Editor) EditDone()
EditDone completes editing and copies the active edited text to the text -- called when the return key is pressed or goes out of focus
func (*Editor) EscPressed ¶
func (ed *Editor) EscPressed()
EscPressed emitted for keyfun.Abort or keyfun.CancelSelect -- effect depends on state..
func (*Editor) FindMatches ¶
FindMatches finds the matches with given search string (literal, not regex) and case sensitivity, updates highlights for all. returns false if none found
func (*Editor) FindNextLink ¶
FindNextLink finds next link after given position, returns false if no such links
func (*Editor) FindPrevLink ¶
FindPrevLink finds previous link before given position, returns false if no such links
func (*Editor) FirstVisibleLine ¶
FirstVisibleLine finds the first visible line, starting at given line (typically cursor -- if zero, a visible line is first found) -- returns stln if nothing found above it.
func (*Editor) FlagType ¶
func (ed *Editor) FlagType() enums.BitFlagSetter
func (*Editor) HandleClose ¶
func (ed *Editor) HandleClose()
func (*Editor) HandleEvents ¶
func (ed *Editor) HandleEvents()
func (*Editor) HandleFocus ¶
func (ed *Editor) HandleFocus()
func (*Editor) HandleKeyChord ¶
func (ed *Editor) HandleKeyChord()
func (*Editor) HandleLinkCursor ¶
func (ed *Editor) HandleLinkCursor()
func (*Editor) HasLineNos ¶
HasLineNos returns true if view is showing line numbers (per textbuf option, cached here)
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) ISearchBackspace ¶
func (ed *Editor) ISearchBackspace()
ISearchBackspace gets rid of one item in search string
func (*Editor) ISearchKeyInput ¶
ISearchKeyInput is an emacs-style interactive search mode -- this is called when keys are typed while in search mode
func (*Editor) ISearchMatches ¶
ISearchMatches finds ISearch matches -- returns true if there are any
func (*Editor) ISearchNextMatch ¶
ISearchNextMatch finds next match after given cursor position, and highlights it, etc
func (*Editor) ISearchSelectMatch ¶
ISearchSelectMatch selects match at given match index (e.g., ed.ISearch.Pos)
func (*Editor) ISearchSig ¶
func (ed *Editor) ISearchSig()
ISearchSig sends the signal that ISearch is updated
func (*Editor) ISearchStart ¶
func (ed *Editor) ISearchStart()
ISearchStart is an emacs-style interactive search mode -- this is called when the search command itself is entered
func (*Editor) ISpellKeyInput ¶
ISpellKeyInput locates the word to spell check based on cursor position and the key input, then passes the text region to SpellCheck
func (*Editor) InsertAtCursor ¶
InsertAtCursor inserts given text at current cursor position
func (*Editor) IsChanged ¶
IsChanged returns true if buffer was changed (edited) since last EditDone
func (*Editor) IsNotSaved ¶
IsNotSaved returns true if buffer was changed (edited) since last Save
func (*Editor) IsWordEnd ¶
IsWordEnd returns true if the cursor is just past the last letter of a word word is a string of characters none of which are classified as a word break
func (*Editor) IsWordMiddle ¶
IsWordMiddle - returns true if the cursor is anywhere inside a word, i.e. the character before the cursor and the one after the cursor are not classified as word break characters
func (*Editor) IsWordStart ¶
IsWordStart returns true if the cursor is just before the start of a word word is a string of characters none of which are classified as a word break
func (*Editor) JumpToLine ¶
JumpToLine jumps to given line number (minus 1)
func (*Editor) JumpToLineAddText ¶
func (ed *Editor) JumpToLineAddText()
JumpToLinePrompt jumps to given line number (minus 1) from prompt
func (*Editor) KeyInput ¶
KeyInput handles keyboard input into the text field and from the completion menu
func (*Editor) KeyInputInsertBra ¶
KeyInputInsertBra handle input of opening bracket-like entity (paren, brace, bracket)
func (*Editor) KeyInputInsertRune ¶
KeyInputInsertRune handles the insertion of a typed character
func (*Editor) LastVisibleLine ¶
LastVisibleLine finds the last visible line, starting at given line (typically cursor) -- returns stln if nothing found beyond it.
func (*Editor) LayoutAll ¶
func (ed *Editor) LayoutAll()
LayoutAll does LayoutAllLines and ManageOverflow to update scrolls
func (*Editor) LayoutAllLines ¶
func (ed *Editor) LayoutAllLines()
LayoutAllLines generates TextRenders of lines from the Markup version of the source in Buf. It computes the total LinesSize and TotalSize.
func (*Editor) LayoutLine ¶
LayoutLine generates render of given line (including highlighting). If the line with exceeds the current maximum, or the number of effective lines (e.g., from word-wrap) is different, then SetNeedsLayout is called and it returns true.
func (*Editor) LinesDeleted ¶
LinesDeleted deletes lines of text and reformats remaining one
func (*Editor) LinesInserted ¶
LinesInserted inserts new lines of text and reformats them
func (*Editor) LinkAt ¶
LinkAt returns link at given cursor position, if one exists there -- returns true and the link if there is a link, and false otherwise
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) MatchFromPos ¶
MatchFromPos finds the match at or after the given text position -- returns 0, false if none
func (*Editor) OfferComplete ¶
func (ed *Editor) OfferComplete()
OfferComplete pops up a menu of possible completions
func (*Editor) OfferCorrect ¶
OfferCorrect pops up a menu of possible spelling corrections for word at current CursorPos -- if no misspelling there or not in spellcorrect mode returns false
func (*Editor) OpenLink ¶
OpenLink opens given link, either by sending LinkSig signal if there are receivers, or by calling the TextLinkHandler if non-nil, or URLHandler if non-nil (which by default opens user's default browser via goosi/App.OpenURL())
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) PasteHist ¶
func (ed *Editor) PasteHist()
PasteHist presents a chooser of clip history items, pastes into text if selected
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) QReplaceAddText ¶
func (ed *Editor) QReplaceAddText()
QReplacePrompt is an emacs-style query-replace mode -- this starts the process, prompting user for items to search etc
func (*Editor) QReplaceCancel ¶
func (ed *Editor) QReplaceCancel()
QReplaceCancel cancels QReplace mode
func (*Editor) QReplaceKeyInput ¶
QReplaceKeyInput is an emacs-style interactive search mode -- this is called when keys are typed while in search mode
func (*Editor) QReplaceMatches ¶
QReplaceMatches finds QReplace matches -- returns true if there are any
func (*Editor) QReplaceNextMatch ¶
QReplaceNextMatch finds next match using, QReplace.Pos and highlights it, etc
func (*Editor) QReplaceReplace ¶
QReplaceReplace replaces at given match index (e.g., ed.QReplace.Pos)
func (*Editor) QReplaceReplaceAll ¶
QReplaceReplaceAll replaces all remaining from index
func (*Editor) QReplaceSelectMatch ¶
QReplaceSelectMatch selects match at given match index (e.g., ed.QReplace.Pos)
func (*Editor) QReplaceSig ¶
func (ed *Editor) QReplaceSig()
QReplaceSig sends the signal that QReplace is updated
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) ReMarkup ¶
func (ed *Editor) ReMarkup()
Remarkup triggers a complete re-markup of the entire text -- can do this when needed if the markup gets off due to multi-line formatting issues -- via Recenter key
func (*Editor) RenderAllLines ¶
func (ed *Editor) RenderAllLines()
RenderAllLines displays all the visible lines on the screen, after PushBounds has already been called.
func (*Editor) RenderCursor ¶
RenderCursor renders the cursor on or off, as a sprite that is either on or off
func (*Editor) RenderDepthBg ¶
RenderDepthBg renders the depth background color.
func (*Editor) RenderHighlights ¶
RenderHighlights renders the highlight regions as a highlighted background color.
func (*Editor) RenderLineNo ¶
RenderLineNo renders given line number -- called within context of other render if defFill is true, it fills box color for default background color (use false for batch mode) and if vpUpload is true it uploads the rendered region to scene directly (only if totally separate from other updates)
func (*Editor) RenderLineNosBox ¶
RenderLineNosBox renders the background for the line numbers in given range, in the LineNumberColor
func (*Editor) RenderLineNosBoxAll ¶
func (ed *Editor) RenderLineNosBoxAll()
RenderLineNosBoxAll renders the background for the line numbers in the LineNumberColor
func (*Editor) RenderRegionBox ¶
RenderRegionBox renders a region in background according to given background
func (*Editor) RenderRegionBoxSty ¶
func (ed *Editor) RenderRegionBoxSty(reg textbuf.Region, sty *styles.Style, bg image.Image, fullWidth bool)
RenderRegionBoxSty renders a region in given style and background
func (*Editor) RenderRegionToEnd ¶
RenderRegionToEnd renders a region in given style and background, to end of line from start
func (*Editor) RenderScopelights ¶
RenderScopelights renders a highlight background color for regions in the Scopelights list.
func (*Editor) RenderSelect ¶
func (ed *Editor) RenderSelect()
RenderSelect renders the selection region as a selected background color.
func (*Editor) RenderSelectLines ¶
func (ed *Editor) RenderSelectLines()
RenderSelectLines renders the lines within the current selection region
func (*Editor) RenderStartPos ¶
func (ed *Editor) RenderStartPos() mat32.Vec2
RenderStartPos is absolute rendering start position from our content pos with scroll This can be offscreen (left, up) based on scrolling.
func (*Editor) ResetState ¶
func (ed *Editor) ResetState()
ResetState resets all the random state variables, when opening a new buffer etc
func (*Editor) SavePosHistory ¶
SavePosHistory saves the cursor position in history stack of cursor positions
func (*Editor) ScrollCursorInView ¶
ScrollCursorInView tells any parent scroll layout to scroll to get cursor in view -- returns true if scrolled
func (*Editor) ScrollCursorToBottom ¶
ScrollCursorToBottom tells any parent scroll layout to scroll to get cursor at bottom of view to extent possible -- returns true if scrolled.
func (*Editor) ScrollCursorToCenterIfHidden ¶
ScrollCursorToCenterIfHidden checks if the cursor is not visible, and if so, scrolls to the center, along both dimensions.
func (*Editor) ScrollCursorToHorizCenter ¶
ScrollCursorToHorizCenter tells any parent scroll layout to scroll to get cursor at horiz center of view to extent possible -- returns true if scrolled.
func (*Editor) ScrollCursorToLeft ¶
ScrollCursorToLeft tells any parent scroll layout to scroll to get cursor at left of view to extent possible -- returns true if scrolled.
func (*Editor) ScrollCursorToRight ¶
ScrollCursorToRight tells any parent scroll layout to scroll to get cursor at right of view to extent possible -- returns true if scrolled.
func (*Editor) ScrollCursorToTarget ¶
func (ed *Editor) ScrollCursorToTarget()
func (*Editor) ScrollCursorToTop ¶
ScrollCursorToTop tells any parent scroll layout to scroll to get cursor at top of view to extent possible -- returns true if scrolled.
func (*Editor) ScrollCursorToVertCenter ¶
ScrollCursorToVertCenter tells any parent scroll layout to scroll to get cursor at vert center of view to extent possible -- returns true if scrolled.
func (*Editor) ScrollInView ¶
ScrollInView tells any parent scroll layout to scroll to get given box (e.g., cursor BBox) in view -- returns true if scrolled
func (*Editor) ScrollToBottom ¶
ScrollToBottom tells any parent scroll layout to scroll to get given vertical coordinate at bottom of view to extent possible -- returns true if scrolled
func (*Editor) ScrollToHorizCenter ¶
ScrollToHorizCenter tells any parent scroll layout to scroll to get given horizontal coordinate to center of view to extent possible -- returns true if scrolled
func (*Editor) ScrollToLeft ¶
ScrollToLeft tells any parent scroll layout to scroll to get given horizontal coordinate at left of view to extent possible -- returns true if scrolled
func (*Editor) ScrollToRight ¶
ScrollToRight tells any parent scroll layout to scroll to get given horizontal coordinate at right of view to extent possible -- returns true if scrolled
func (*Editor) ScrollToTop ¶
ScrollToTop tells any parent scroll layout to scroll to get given vertical coordinate at top of view to extent possible -- returns true if scrolled
func (*Editor) ScrollToVertCenter ¶
ScrollToVertCenter tells any parent scroll layout to scroll to get given vertical coordinate to center of view to extent possible -- returns true if scrolled
func (*Editor) SelectModeToggle ¶
func (ed *Editor) SelectModeToggle()
SelectModeToggle toggles the SelectMode, updating selection with cursor movement
func (*Editor) SelectRegUpdate ¶
SelectRegUpdate updates current select region based on given cursor position relative to SelectStart position
func (*Editor) SelectWord ¶
SelectWord selects the word (whitespace, punctuation delimited) that the cursor is on returns true if word selected
func (*Editor) Selection ¶
Selection returns the currently selected text as a textbuf.Edit, which captures start, end, and full lines in between -- nil if no selection
func (*Editor) SetCursor ¶
SetCursor sets a new cursor position, enforcing it in range. This is the main final pathway for all cursor movement.
func (*Editor) SetCursorCol ¶
SetCursorCol sets the current target cursor column (CursorCol) to that of the given position
func (*Editor) SetCursorColor ¶
SetCursorColor sets the [Editor.CursorColor]: the color used for the text field cursor (caret); this should be set in Stylers like all other style properties
func (*Editor) SetCursorFromMouse ¶
SetCursorFromMouse sets cursor position from mouse mouse action -- handles the selection updating etc.
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]: width of cursor -- set from cursor-width property (inherited)
func (*Editor) SetHighlightColor ¶
SetHighlightColor sets the [Editor.HighlightColor]: 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]: 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]: handles link clicks -- if nil, they are sent to the standard web URL handler
func (*Editor) SetNeedsLayout ¶
func (*Editor) SetPlaceholder ¶
SetPlaceholder sets the [Editor.Placeholder]: text that is displayed when the field is empty, in a lower-contrast manner
func (*Editor) SetSelectColor ¶
SetSelectColor sets the [Editor.SelectColor]: the color used for the user text selection background color; this should be set in Stylers like all other style properties
func (*Editor) SetStackTop ¶
SetStackTop sets the [Editor.StackTop]
func (*Editor) SetTooltip ¶
SetTooltip sets the [Editor.Tooltip]
func (*Editor) ShiftSelect ¶
ShiftSelect sets the selection start if the shift key is down but wasn't on the last key move. If the shift key has been released the select region is set to textbuf.RegionNil
func (*Editor) ShiftSelectExtend ¶
ShiftSelectExtend updates the select region if the shift key is down and renders the selected text. If the shift key is not down the previously selected text is rerendered to clear the highlight
func (*Editor) ShowContextMenu ¶
ShowContextMenu displays the context menu with options dependent on situation
func (*Editor) SpellCheck ¶
SpellCheck offers spelling corrections if we are at a word break or other word termination and the word before the break is unknown -- returns true if misspelled word found
func (*Editor) StartCursor ¶
func (ed *Editor) StartCursor()
StartCursor starts the cursor blinking and renders it
func (*Editor) StopCursor ¶
func (ed *Editor) StopCursor()
StopCursor stops the cursor from blinking
func (*Editor) StyleSizes ¶
func (ed *Editor) StyleSizes()
StyleSizes gets the size info based on Style settings.
func (*Editor) TextStyleProps ¶
func (ed *Editor) TextStyleProps() ki.Props
TextStyleProps returns the styling properties for text based on HiStyle Markup
func (*Editor) UpdateFromAlloc ¶
func (ed *Editor) UpdateFromAlloc()
UpdateFromAlloc updates size info based on allocated size: NLinesChars, LineNoOff, LineLayoutSize
func (*Editor) ValidateCursor ¶
func (ed *Editor) ValidateCursor()
ValidateCursor sets current cursor to a valid cursor position
func (*Editor) WordBefore ¶
WordBefore returns the word before the lex.Pos uses IsWordBreak to determine the bounds of the word
func (*Editor) WrappedLineNo ¶
WrappedLineNo returns the wrapped line number (span index) and rune index within that span of the given character position within line in position, and false if out of range (last valid position returned in that case -- still usable).
func (*Editor) WrappedLines ¶
WrappedLines returns the number of wrapped lines (spans) for given line number
type EditorEmbedder ¶
type EditorEmbedder interface {
AsEditor() *Editor
}
EditorEmbedder is an interface that all types that embed Editor satisfy
type EditorFlags ¶
type EditorFlags gi.WidgetFlags //enums:bitflag -trim-prefix View
EditorFlags extend WidgetFlags to hold Editor state
const ( // EditorHasLineNos indicates that this editor has line numbers (per Buf option) EditorHasLineNos EditorFlags = EditorFlags(gi.WidgetFlagsN) + iota // EditorNeedsLayout is set by SetNeedsLayout: Editor does significant // internal layout in LayoutAllLines, and its layout is simply based // on what it gets allocated, so it does not affect the rest // of the Scene. EditorNeedsLayout // EditorLastWasTabAI indicates that last key was a Tab auto-indent EditorLastWasTabAI // EditorLastWasUndo indicates that last key was an undo EditorLastWasUndo // EditorTargetSet indicates that the CursorTarget is set EditorTargetSet )
const EditorFlagsN EditorFlags = 13
EditorFlagsN is the highest valid value for type EditorFlags, plus one.
func EditorFlagsValues ¶
func EditorFlagsValues() []EditorFlags
EditorFlagsValues returns all possible values for the type EditorFlags.
func (EditorFlags) BitIndexString ¶
func (i EditorFlags) BitIndexString() string
BitIndexString returns the string representation of this EditorFlags value if it is a bit index value (typically an enum constant), and not an actual bit flag value.
func (EditorFlags) Desc ¶
func (i EditorFlags) Desc() string
Desc returns the description of the EditorFlags value.
func (EditorFlags) HasFlag ¶
func (i EditorFlags) HasFlag(f enums.BitFlag) bool
HasFlag returns whether these bit flags have the given bit flag set.
func (EditorFlags) Int64 ¶
func (i EditorFlags) Int64() int64
Int64 returns the EditorFlags value as an int64.
func (EditorFlags) IsValid ¶
func (i EditorFlags) IsValid() bool
IsValid returns whether the value is a valid option for type EditorFlags.
func (EditorFlags) MarshalText ¶
func (i EditorFlags) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (*EditorFlags) SetFlag ¶
func (i *EditorFlags) SetFlag(on bool, f ...enums.BitFlag)
SetFlag sets the value of the given flags in these flags to the given value.
func (*EditorFlags) SetInt64 ¶
func (i *EditorFlags) SetInt64(in int64)
SetInt64 sets the EditorFlags value from an int64.
func (*EditorFlags) SetString ¶
func (i *EditorFlags) SetString(s string) error
SetString sets the EditorFlags value from its string representation, and returns an error if the string is invalid.
func (*EditorFlags) SetStringOr ¶
func (i *EditorFlags) SetStringOr(s string) error
SetStringOr sets the EditorFlags value from its string representation while preserving any bit flags already set, and returns an error if the string is invalid.
func (EditorFlags) String ¶
func (i EditorFlags) String() string
String returns the string representation of this EditorFlags value.
func (*EditorFlags) UnmarshalText ¶
func (i *EditorFlags) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (EditorFlags) Values ¶
func (i EditorFlags) Values() []enums.Enum
Values returns all possible values for the type EditorFlags.
type HiMarkup ¶
type HiMarkup struct { // full info about the file including category etc Info *fi.FileInfo // syntax highlighting style Style gi.HiStyleName // chroma-based language name for syntax highlighting the code Lang string // true if both lang and style are set Has bool // tab size, in chars TabSize int // Commpiled CSS properties for given highlighting style CSSProps ki.Props `json:"-" xml:"-"` // pi parser state info PiState *pi.FileStates // if supported, this is the pi Lang support for parsing PiLang pi.Lang // current highlighting style HiStyle *histyle.Style // external toggle to turn off automatic highlighting Off bool // contains filtered or unexported fields }
HiMarkup manages the syntax highlighting state for Buf. It uses Pi if available, otherwise falls back on chroma
func (*HiMarkup) ChromaTagsAll ¶
ChromaTagsAll returns all the markup tags according to current syntax highlighting settings
func (*HiMarkup) ChromaTagsLine ¶
ChromaTagsLine returns tags for one line according to current syntax highlighting settings
func (*HiMarkup) HasHi ¶
HasHi returns true if there are highlighting parameters set (only valid after Init)
func (*HiMarkup) Init ¶
func (hm *HiMarkup) Init(info *fi.FileInfo, pist *pi.FileStates)
Init initializes the syntax highlighting for current params
func (*HiMarkup) MarkupLine ¶
MarkupLine returns the line with html class tags added for each tag takes both the hi tags and extra tags. Only fully nested tags are supported -- any dangling ends are truncated.
func (*HiMarkup) MarkupTagsAll ¶
MarkupTagsAll returns all the markup tags according to current syntax highlighting settings
func (*HiMarkup) MarkupTagsLine ¶
MarkupTagsLine returns tags for one line according to current syntax highlighting settings
func (*HiMarkup) SetHiStyle ¶
func (hm *HiMarkup) SetHiStyle(style gi.HiStyleName)
SetHiStyle sets the highlighting style and updates corresponding settings
type ISearch ¶
type ISearch struct { // if true, in interactive search mode On bool `json:"-" xml:"-"` // current interactive search string Find string `json:"-" xml:"-"` // pay attention to case in isearch -- triggered by typing an upper-case letter UseCase bool `json:"-" xml:"-"` // current search matches Matches []textbuf.Match `json:"-" xml:"-"` // position within isearch matches Pos int `json:"-" xml:"-"` // position in search list from previous search PrevPos int `json:"-" xml:"-"` // starting position for search -- returns there after on cancel StartPos lex.Pos `json:"-" xml:"-"` }
ISearch holds all the interactive search data
type OutBuf ¶
type OutBuf struct { // the output that we are reading from, as an io.Reader Out io.Reader // the Buf that we output to Buf *Buf // 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 MarkupFun OutBufMarkupFunc // current buffered output raw lines -- not yet sent to Buf CurOutLns [][]byte // current buffered output markup lines -- not yet sent to Buf CurOutMus [][]byte // mutex protecting updating of CurOutLns and Buf, and timer Mu sync.Mutex // time when last output was sent to buffer LastOut time.Time // time.AfterFunc that is started after new input is received and not immediately output -- ensures that it will get output if no further burst happens AfterTimer *time.Timer }
OutBuf is a Buf that records the output from an io.Reader using bufio.Scanner -- optimized to combine fast chunks of output into large blocks of updating. Also supports arbitrary markup function that operates on each line of output bytes.
type OutBufMarkupFunc ¶
OutBufMarkupFunc 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:"-"` // pay attention to case in isearch -- triggered by typing an upper-case letter UseCase bool `json:"-" xml:"-"` // search only as entire lexically-tagged item boundaries -- key for replacing short local variables like i LexItems bool `json:"-" xml:"-"` // current search matches Matches []textbuf.Match `json:"-" xml:"-"` // position within isearch matches Pos int `json:"-" xml:"-"` // position in search list from previous search PrevPos int `json:"-" xml:"-"` // starting position for search -- returns there after on cancel StartPos lex.Pos `json:"-" xml:"-"` }
QReplace holds all the query-replace data
type TwinEditors ¶
type TwinEditors struct { gi.Splits // textbuf for A BufA *Buf `json:"-" xml:"-"` // textbuf for B BufB *Buf `json:"-" xml:"-"` }
TwinEditors presents two side-by-side [Editor]s in gi.Splits that scroll in sync with each other.
func NewTwinEditors ¶
func NewTwinEditors(par ki.Ki, name ...string) *TwinEditors
NewTwinEditors adds a new TwinEditors with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*TwinEditors) ConfigTexts ¶
func (te *TwinEditors) ConfigTexts()
func (*TwinEditors) Editors ¶
func (te *TwinEditors) Editors() (*Editor, *Editor)
Editors returns the two text Editors
func (*TwinEditors) KiType ¶
func (t *TwinEditors) KiType() *gti.Type
KiType returns the *gti.Type of TwinEditors
func (*TwinEditors) MakeBufs ¶
func (te *TwinEditors) MakeBufs()
MakeBufs ensures that the Bufs are made, if nil
func (*TwinEditors) OnInit ¶
func (te *TwinEditors) OnInit()
func (*TwinEditors) SetBufA ¶
func (t *TwinEditors) SetBufA(v *Buf) *TwinEditors
SetBufA sets the [TwinEditors.BufA]: textbuf for A
func (*TwinEditors) SetBufB ¶
func (t *TwinEditors) SetBufB(v *Buf) *TwinEditors
SetBufB sets the [TwinEditors.BufB]: textbuf for B
func (*TwinEditors) SetFiles ¶
func (te *TwinEditors) SetFiles(fileA, fileB string, lineNos bool)
SetFiles sets files for each text buf
func (*TwinEditors) SetStackTop ¶
func (t *TwinEditors) SetStackTop(v int) *TwinEditors
SetStackTop sets the [TwinEditors.StackTop]
func (*TwinEditors) SetStyles ¶
func (te *TwinEditors) SetStyles()
func (*TwinEditors) SetTooltip ¶
func (t *TwinEditors) SetTooltip(v string) *TwinEditors
SetTooltip sets the [TwinEditors.Tooltip]
type Value ¶
Value is a texteditor.Editor giv.Value for editing longer text
func (*Value) ConfigWidget ¶
func (*Value) UpdateWidget ¶
func (vv *Value) UpdateWidget()
func (*Value) WidgetType ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package histyle provides syntax highlighting styles; it is based on github.com/alecthomas/chroma, which in turn was based on the python pygments package.
|
Package histyle provides syntax highlighting styles; it is based on github.com/alecthomas/chroma, which in turn was based on the python pygments package. |