indent list lines

This commit is contained in:
Dan Anglin 2024-07-07 22:46:40 +01:00
parent f8300a1771
commit 527fd069df
Signed by: dananglin
GPG key ID: 0C1D44CFBEE68638

View file

@ -19,13 +19,19 @@ func (p Printer) wrapLines(text string, nIndent int) string {
lines := strings.Split(text, "\n")
if len(lines) == 1 {
return wrapLine(lines[0], separator, p.lineWrapCharacterLimit - nIndent)
return wrapLine(lines[0], separator, p.lineWrapCharacterLimit-nIndent)
}
var builder strings.Builder
for i, line := range lines {
builder.WriteString(wrapLine(line, separator, p.lineWrapCharacterLimit - nIndent))
extraIndent := ""
if strings.HasPrefix(line, symbolBullet) {
extraIndent = " "
}
builder.WriteString(wrapLine(line, separator+extraIndent, p.lineWrapCharacterLimit-nIndent))
if i < len(lines)-1 {
builder.WriteString(separator)