memedit

package
v1.3.3-rc8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemEditor

type MemEditor struct {
	// contains filtered or unexported fields
}

func NewMemEditor

func NewMemEditor(sourceCode string) *MemEditor

func (*MemEditor) CompareRangeWithString

func (ve *MemEditor) CompareRangeWithString(start, end int, compareTo string) (bool, error)

比较指定范围的文本是否与给定字符串相同

func (*MemEditor) ExpandWordTextRange

func (ve *MemEditor) ExpandWordTextRange(i RangeIf) RangeIf

func (*MemEditor) FindRegexpRange

func (ve *MemEditor) FindRegexpRange(patternStr string, callback func(RangeIf) error) error

func (*MemEditor) FindStringRange

func (ve *MemEditor) FindStringRange(feature string, callback func(RangeIf) error) error

func (*MemEditor) FindStringRangeIndexFirst

func (ve *MemEditor) FindStringRangeIndexFirst(startIndex int, feature string, callback func(RangeIf)) (end int, ok bool)

func (*MemEditor) GetContextAroundRange

func (ve *MemEditor) GetContextAroundRange(startPos, endPos PositionIf, n int, prefix ...func(i int) string) (string, error)

func (*MemEditor) GetCurrentLine

func (ve *MemEditor) GetCurrentLine() (string, error)

GetCurrentLine 返回当前光标所在行的内容

func (*MemEditor) GetEndOffsetByLine

func (ve *MemEditor) GetEndOffsetByLine(x int) (int, error)

func (*MemEditor) GetLine

func (ve *MemEditor) GetLine(x int) (string, error)

获取指定行的内容

func (*MemEditor) GetMinAndMaxOffset

func (ve *MemEditor) GetMinAndMaxOffset(pos ...PositionIf) (int, int)

func (*MemEditor) GetOffsetByPosition

func (ve *MemEditor) GetOffsetByPosition(p PositionIf) int

func (*MemEditor) GetOffsetByPositionRaw

func (ve *MemEditor) GetOffsetByPositionRaw(line, col int) int

func (*MemEditor) GetOffsetByPositionWithError

func (ve *MemEditor) GetOffsetByPositionWithError(line, col int) (int, error)

func (*MemEditor) GetPositionByOffset

func (ve *MemEditor) GetPositionByOffset(offset int) PositionIf

func (*MemEditor) GetPositionByOffsetWithError

func (ve *MemEditor) GetPositionByOffsetWithError(offset int) (PositionIf, error)

func (*MemEditor) GetSourceCode

func (ve *MemEditor) GetSourceCode() string

func (*MemEditor) GetStartOffsetByLine

func (ve *MemEditor) GetStartOffsetByLine(x int) (int, error)

func (*MemEditor) GetTextFromOffset

func (ve *MemEditor) GetTextFromOffset(offset1, offset2 int) string

func (*MemEditor) GetTextFromPosition

func (ve *MemEditor) GetTextFromPosition(p1, p2 PositionIf) string

func (*MemEditor) GetTextFromRange

func (ve *MemEditor) GetTextFromRange(i RangeIf) string

func (*MemEditor) GetTextFromRangeContext

func (ve *MemEditor) GetTextFromRangeContext(i RangeIf, lineNum int) string

func (*MemEditor) GetTextFromRangeWithError

func (ve *MemEditor) GetTextFromRangeWithError(r RangeIf) (string, error)

GetTextFromRangeWithError 根据Range获取文本,优先使用Offset,其次使用Line和Column

func (*MemEditor) GetUrl

func (ve *MemEditor) GetUrl() string

func (*MemEditor) GetWordTextFromRange

func (ve *MemEditor) GetWordTextFromRange(i RangeIf) string

func (*MemEditor) IsOffsetValid

func (ve *MemEditor) IsOffsetValid(offset int) bool

func (*MemEditor) IsValidPosition

func (ve *MemEditor) IsValidPosition(line, col int) bool

func (*MemEditor) MoveCursor

func (ve *MemEditor) MoveCursor(position int) error

MoveCursor 移动模拟光标位置

func (*MemEditor) PushSourceCodeContext

func (ve *MemEditor) PushSourceCodeContext(i any)

func (*MemEditor) ResetSourceCodeHash

func (ve *MemEditor) ResetSourceCodeHash()

func (*MemEditor) Select

func (ve *MemEditor) Select(start, end int) (string, error)

Select 返回指定范围的文本

func (*MemEditor) SetUrl

func (ve *MemEditor) SetUrl(url string)

func (*MemEditor) SourceCodeMd5

func (ve *MemEditor) SourceCodeMd5() string

func (*MemEditor) SourceCodeSha1

func (ve *MemEditor) SourceCodeSha1() string

func (*MemEditor) SourceCodeSha256

func (ve *MemEditor) SourceCodeSha256() string

func (*MemEditor) UpdateTextByRange

func (ve *MemEditor) UpdateTextByRange(r RangeIf, newText string) error

UpdateTextByRange 根据Range更新文本,优先使用Offset,其次使用Line和Column

type Position

type Position struct {
	// contains filtered or unexported fields
}

func NewPosition

func NewPosition(line, column int) *Position

func (*Position) GetColumn

func (p *Position) GetColumn() int

func (*Position) GetLine

func (p *Position) GetLine() int

type PositionIf

type PositionIf interface {
	GetLine() int
	GetColumn() int
}

type Range

type Range struct {
	// contains filtered or unexported fields
}

func NewRange

func NewRange(p1, p2 PositionIf) *Range

func (*Range) GetEnd

func (r *Range) GetEnd() PositionIf

func (*Range) GetStart

func (r *Range) GetStart() PositionIf

type RangeIf

type RangeIf interface {
	GetStart() PositionIf
	GetEnd() PositionIf
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL