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

Method Size

internal/buffer/buffer.go:703–716  ·  view source on GitHub ↗

Size returns the number of bytes in the current buffer

()

Source from the content-addressed store, hash-verified

701
702// Size returns the number of bytes in the current buffer
703func (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
718func parseDefFromFile(f config.RuntimeFile, header *highlight.Header) *highlight.Def {
719 data, err := f.Data()

Callers 10

DoSetOptionNativeMethod · 0.95
updateDisplayInfoMethod · 0.80
NewInfoWindowFunction · 0.80
AddTabMethod · 0.80
NewTabListFunction · 0.80
ResizeMethod · 0.80
RawCmdMethod · 0.80
NewTabCmdMethod · 0.80
FSizeFunction · 0.80
DownloadAndInstallMethod · 0.80

Calls 2

LinesNumMethod · 0.65
LineBytesMethod · 0.65

Tested by

no test coverage detected