Size returns the number of bytes in the current buffer
()
| 701 | |
| 702 | // Size returns the number of bytes in the current buffer |
| 703 | func (b *Buffer) Size() int { |
| 704 | nb := 0 |
| 705 | for i := 0; i < b.LinesNum(); i++ { |
| 706 | nb += len(b.LineBytes(i)) |
| 707 | |
| 708 | if i != b.LinesNum()-1 { |
| 709 | if b.Endings == FFDos { |
| 710 | nb++ // carriage return |
| 711 | } |
| 712 | nb++ // newline |
| 713 | } |
| 714 | } |
| 715 | return nb |
| 716 | } |
| 717 | |
| 718 | func parseDefFromFile(f config.RuntimeFile, header *highlight.Header) *highlight.Def { |
| 719 | data, err := f.Data() |
no test coverage detected