Versions in this module Expand all Collapse all v0 v0.3.8 Jan 24, 2025 v0.3.7 Dec 10, 2024 v0.3.6 Dec 9, 2024 v0.3.5 Oct 19, 2024 v0.3.4 Sep 30, 2024 v0.3.3 Sep 9, 2024 v0.3.2 Aug 17, 2024 v0.3.1 Aug 2, 2024 v0.3.0 Jul 24, 2024 Changes in this version + const IgnoreCase + const ReplaceMatchCase + const ReplaceNoMatchCase + const UseCase + var SearchContext = 30 + var UndoGroupDelay = 250 * time.Millisecond + var UndoTrace = false + func ApplyOneDiff(op difflib.OpCode, bedit *[]string, aorig []string, blmap []int) + func BytesToLineStrings(txt []byte, addNewLn bool) []string + func CountWordsLines(reader io.Reader) (words, lines int) + func CountWordsLinesRegion(src [][]rune, reg Region) (words, lines int) + func DiffLinesUnified(astr, bstr []string, context int, afile, adate, bfile, bdate string) []byte + func DiffOpReverse(op difflib.OpCode) difflib.OpCode + func DiffOpString(op difflib.OpCode) string + func FileBytes(fpath string) ([]byte, error) + func FileRegionBytes(fpath string, stLn, edLn int, preComments bool, lnBack int) []byte + func KnownComments(fpath string) (comLn, comSt, comEd string) + func PreCommentStart(lns [][]byte, stLn int, comLn, comSt, comEd string, lnBack int) int + func StringLinesToByteLines(str []string) [][]byte + type AdjustPosDel int + const AdjustPosDelEnd + const AdjustPosDelErr + const AdjustPosDelStart + type DiffSelectData struct + Edit []string + EditUndo [][]string + LineMap []int + LineMapUndo [][]int + Orig []string + Undos Diffs + func (ds *DiffSelectData) SaveUndo(op difflib.OpCode) + func (ds *DiffSelectData) SetStringLines(s []string) + func (ds *DiffSelectData) Undo() bool + type DiffSelected struct + A DiffSelectData + B DiffSelectData + Diffs Diffs + func NewDiffSelected(astr, bstr []string) *DiffSelected + func (ds *DiffSelected) AtoB(idx int) + func (ds *DiffSelected) BtoA(idx int) + func (ds *DiffSelected) SetStringLines(astr, bstr []string) + type Diffs []difflib.OpCode + func DiffLines(astr, bstr []string) Diffs + func (di Diffs) DiffForLine(line int) (int, difflib.OpCode) + func (di Diffs) Reverse() Diffs + func (di Diffs) String() string + func (dif Diffs) ToPatch(bstr []string) Patch + type Edit struct + Delete bool + Group int + Rect bool + Reg Region + Text [][]rune + func (te *Edit) AdjustPos(pos lexer.Pos, del AdjustPosDel) lexer.Pos + func (te *Edit) AdjustPosIfAfterTime(pos lexer.Pos, t time.Time, del AdjustPosDel) lexer.Pos + func (te *Edit) AdjustReg(reg Region) Region + func (te *Edit) Clone() *Edit + func (te *Edit) CopyFrom(cp *Edit) + func (te *Edit) ToBytes() []byte + type Lines struct + ChangedFunc func() + Highlighter highlighting.Highlighter + Markup [][]byte + MarkupDoneFunc func() + Options Options + ParseState parse.FileStates + Undos Undo + func (ls *Lines) AddTag(ln, st, ed int, tag token.Tokens) + func (ls *Lines) AddTagEdit(tbe *Edit, tag token.Tokens) + func (ls *Lines) AdjustRegion(reg Region) Region + func (ls *Lines) AdjustedTags(ln int) lexer.Line + func (ls *Lines) AdjustedTagsLine(tags lexer.Line, ln int) lexer.Line + func (ls *Lines) AppendTextLineMarkup(text []byte, markup []byte) *Edit + func (ls *Lines) AppendTextMarkup(text []byte, markup []byte) *Edit + func (ls *Lines) AutoIndent(ln int) (tbe *Edit, indLev, chPos int) + func (ls *Lines) AutoIndentRegion(start, end int) + func (ls *Lines) BraceMatch(r rune, st lexer.Pos) (en lexer.Pos, found bool) + func (ls *Lines) Bytes() []byte + func (ls *Lines) CommentRegion(start, end int) + func (ls *Lines) CountWordsLinesRegion(reg Region) (words, lines int) + func (ls *Lines) DeleteText(st, ed lexer.Pos) *Edit + func (ls *Lines) DeleteTextRect(st, ed lexer.Pos) *Edit + func (ls *Lines) DiffBuffers(ob *Lines) Diffs + func (ls *Lines) EmacsUndoSave() + func (ls *Lines) EndPos() lexer.Pos + func (ls *Lines) HiTagAtPos(pos lexer.Pos) (*lexer.Lex, int) + func (ls *Lines) HiTags(ln int) lexer.Line + func (ls *Lines) InComment(pos lexer.Pos) bool + func (ls *Lines) InLitString(pos lexer.Pos) bool + func (ls *Lines) InTokenCode(pos lexer.Pos) bool + func (ls *Lines) InTokenSubCat(pos lexer.Pos, subCat token.Tokens) bool + func (ls *Lines) IndentLine(ln, ind int) *Edit + func (ls *Lines) InsertText(st lexer.Pos, text []byte) *Edit + func (ls *Lines) InsertTextRect(tbe *Edit) *Edit + func (ls *Lines) IsChanged() bool + func (ls *Lines) IsValidLine(ln int) bool + func (ls *Lines) JoinParaLines(startLine, endLine int) + func (ls *Lines) LexObjPathString(ln int, lx *lexer.Lex) string + func (ls *Lines) Line(ln int) []rune + func (ls *Lines) LineBytes(ln int) []byte + func (ls *Lines) LineChar(ln, ch int) rune + func (ls *Lines) LineLen(ln int) int + func (ls *Lines) MarkupLines(st, ed int) bool + func (ls *Lines) NumLines() int + func (ls *Lines) PatchFromBuffer(ob *Lines, diffs Diffs) bool + func (ls *Lines) ReMarkup() + func (ls *Lines) Redo() []*Edit + func (ls *Lines) Region(st, ed lexer.Pos) *Edit + func (ls *Lines) RegionRect(st, ed lexer.Pos) *Edit + func (ls *Lines) RemoveTag(pos lexer.Pos, tag token.Tokens) (reg lexer.Lex, ok bool) + func (ls *Lines) ReplaceText(delSt, delEd, insPos lexer.Pos, insTxt string, matchCase bool) *Edit + func (ls *Lines) Search(find []byte, ignoreCase, lexItems bool) (int, []Match) + func (ls *Lines) SearchRegexp(re *regexp.Regexp) (int, []Match) + func (ls *Lines) SetChanged(changed bool) + func (ls *Lines) SetFileExt(ext string) + func (ls *Lines) SetFileInfo(info *fileinfo.FileInfo) + func (ls *Lines) SetHighlighting(style core.HighlightingName) + func (ls *Lines) SetLanguage(ftyp fileinfo.Known) + func (ls *Lines) SetTags(ln int, tags lexer.Line) + func (ls *Lines) SetText(text []byte) + func (ls *Lines) SetTextLines(lns [][]byte) + func (ls *Lines) SpacesToTabs(start, end int) + func (ls *Lines) StartDelayedReMarkup() + func (ls *Lines) StopDelayedReMarkup() + func (ls *Lines) Strings(addNewLine bool) []string + func (ls *Lines) TabsToSpaces(start, end int) + func (ls *Lines) Undo() []*Edit + func (ls *Lines) ValidPos(pos lexer.Pos) lexer.Pos + type Match struct + Reg Region + Text []byte + func NewMatch(rn []rune, st, ed, ln int) Match + func Search(reader io.Reader, find []byte, ignoreCase bool) (int, []Match) + func SearchByteLinesRegexp(src [][]byte, re *regexp.Regexp) (int, []Match) + func SearchFile(filename string, find []byte, ignoreCase bool) (int, []Match) + func SearchFileRegexp(filename string, re *regexp.Regexp) (int, []Match) + func SearchLexItems(src [][]rune, lexs []lexer.Line, find []byte, ignoreCase bool) (int, []Match) + func SearchRegexp(reader io.Reader, re *regexp.Regexp) (int, []Match) + func SearchRuneLines(src [][]rune, find []byte, ignoreCase bool) (int, []Match) + type Options struct + CommentEnd string + CommentLine string + CommentStart string + func (tb *Options) CommentStrings() (comst, comed string) + func (tb *Options) ConfigKnown(sup fileinfo.Known) bool + func (tb *Options) IndentChar() indent.Character + type Patch []*PatchRec + func (pt Patch) Apply(astr []string) []string + func (pt Patch) NumBlines() int + type PatchRec struct + Blines []string + Op difflib.OpCode + type Region struct + End lexer.Pos + Start lexer.Pos + Time nptime.Time + var RegionNil Region + func NewRegion(stLn, stCh, edLn, edCh int) Region + func NewRegionLen(start lexer.Pos, len int) Region + func NewRegionPos(st, ed lexer.Pos) Region + func (tr *Region) Age() time.Duration + func (tr *Region) Ago(t time.Time) time.Duration + func (tr *Region) Contains(ln int) bool + func (tr *Region) FromString(link string) bool + func (tr *Region) IsAfterTime(t time.Time) bool + func (tr *Region) IsNil() bool + func (tr *Region) IsSameLine() bool + func (tr *Region) Since(earlier *Region) time.Duration + func (tr *Region) TimeNow() + type Undo struct + Group int + Mu sync.Mutex + Off bool + Pos int + Stack []*Edit + UndoStack []*Edit + func (un *Undo) AdjustRegion(reg Region) Region + func (un *Undo) NewGroup() + func (un *Undo) RedoNext() *Edit + func (un *Undo) RedoNextIfGroup(gp int) *Edit + func (un *Undo) Reset() + func (un *Undo) Save(tbe *Edit) + func (un *Undo) SaveUndo(tbe *Edit) + func (un *Undo) UndoPop() *Edit + func (un *Undo) UndoPopIfGroup(gp int) *Edit + func (un *Undo) UndoStackSave()