MCPcopy
hub / github.com/micro-editor/micro / RuneAt

Method RuneAt

internal/buffer/buffer.go:647–663  ·  view source on GitHub ↗

RuneAt returns the rune at a given location in the buffer

(loc Loc)

Source from the content-addressed store, hash-verified

645
646// RuneAt returns the rune at a given location in the buffer
647func (b *Buffer) RuneAt(loc Loc) rune {
648 line := b.LineBytes(loc.Y)
649 if len(line) > 0 {
650 i := 0
651 for len(line) > 0 {
652 r, _, size := util.DecodeCharacter(line)
653 line = line[size:]
654
655 if i == loc.X {
656 return r
657 }
658
659 i++
660 }
661 }
662 return '\n'
663}
664
665// WordAt returns the word around a given location in the buffer
666func (b *Buffer) WordAt(loc Loc) []byte {

Callers 4

saveToFileMethod · 0.95
WordAtMethod · 0.95
GetWordMethod · 0.95
updateTrailingWsMethod · 0.80

Calls 2

DecodeCharacterFunction · 0.92
LineBytesMethod · 0.65

Tested by

no test coverage detected