RuneAt returns the rune at a given location in the buffer
(loc Loc)
| 645 | |
| 646 | // RuneAt returns the rune at a given location in the buffer |
| 647 | func (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 |
| 666 | func (b *Buffer) WordAt(loc Loc) []byte { |
no test coverage detected