Skip to content

Commit

Permalink
Rename func
Browse files Browse the repository at this point in the history
  • Loading branch information
giulianopz committed Jul 13, 2023
1 parent dd0ae21 commit fb7bd02
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pkg/display/rendering.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (d *display) renderArticleText() {
if c == '\r' || c == '\n' {

if len(line) != 0 {
d.rendered = append(d.rendered, withMargin(margin, line))
d.rendered = append(d.rendered, add(margin, line))
}
d.rendered = append(d.rendered, []byte{})
line = make([]byte, 0)
Expand All @@ -102,23 +102,23 @@ func (d *display) renderArticleText() {
if len(line) < textSpace {
line = append(line, []byte(string(c))...)
} else {
d.rendered = append(d.rendered, withMargin(margin, line))
d.rendered = append(d.rendered, add(margin, line))
line = make([]byte, 0)
line = append(line, []byte(string(c))...)
}
}

if len(line) != 0 {
d.rendered = append(d.rendered, withMargin(margin, line))
d.rendered = append(d.rendered, add(margin, line))
}
}

func withMargin(margin int, line []byte) []byte {
if margin != 0 {
func add(num int, line []byte) []byte {
if num != 0 {
padded := make([]byte, 0)
for margin != 0 {
for num != 0 {
padded = append(padded, ' ')
margin--
num--
}
padded = append(padded, line...)
return padded
Expand Down

0 comments on commit fb7bd02

Please sign in to comment.