Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
raspi committed Jan 21, 2020
1 parent 40c733a commit d550e4b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions pkg/reader/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ type Colors struct {

type Reader struct {
r iface.ReadSeekerCloser
charFormatters []ByteFormatter // list of byte displayer(s) for data
charFormatterCount int
offsetFormatter []OffsetFormatter // offset formatters (max 2) first one is displayed on the left side and second one on the right side
offsetFormatterCount int
fileSize int64 // file size reference, -1 means STDIN
charFormatters []ByteFormatter // list of byte displayer(s) for data
charFormatterCount int // shorthand for len(charFormatters), for speeding up
offsetFormatter []OffsetFormatter // offset formatters (max 2) first one is displayed on the left side and second one on the right side
offsetFormatterCount int // shorhand for len(offsetFormatter), for speeding up
fileSize int64 // file size reference, -1 means STDIN. Hint for offset formatter(s) for how many padding characters to use.
ReadBytes uint64 // How many bytes Reader has been reading so far (for limit)
sb strings.Builder // Faster than concatenating strings
Splitter string // Splitter character for columns
offsetFormatterFormat map[OffsetFormatter]string // Printf format
offsetFormatterWidth map[OffsetFormatter]int // How much padding width needed
offsetFormatterFormat map[OffsetFormatter]string // Printf format for offset format
offsetFormatterWidth map[OffsetFormatter]int // How much padding width needed, calculated from fileSize variable
Colors Colors // Colors
growHint int // Grow hint for strings.Builder for speed
growHint int // Grow hint for sb strings.Builder variable for speed
}

func New(r iface.ReadSeekerCloser, offsetFormatter []OffsetFormatter, formatters []ByteFormatter, palette [256]color.AnsiColor, filesize int64) *Reader {
Expand All @@ -50,9 +50,9 @@ func New(r iface.ReadSeekerCloser, offsetFormatter []OffsetFormatter, formatters
fileSize: filesize,
charFormatters: formatters,
offsetFormatter: offsetFormatter,
ReadBytes: 0,
ReadBytes: 0, // How many byte's we've read
sb: strings.Builder{},
Splitter: `┊`,
Splitter: `┊`, // Splitter character between different columns
charFormatterCount: len(formatters),
offsetFormatterCount: len(offsetFormatter),
Colors: Colors{
Expand Down

0 comments on commit d550e4b

Please sign in to comment.