indent list lines
This commit is contained in:
parent
f8300a1771
commit
527fd069df
1 changed files with 8 additions and 2 deletions
|
@ -19,13 +19,19 @@ func (p Printer) wrapLines(text string, nIndent int) string {
|
||||||
lines := strings.Split(text, "\n")
|
lines := strings.Split(text, "\n")
|
||||||
|
|
||||||
if len(lines) == 1 {
|
if len(lines) == 1 {
|
||||||
return wrapLine(lines[0], separator, p.lineWrapCharacterLimit - nIndent)
|
return wrapLine(lines[0], separator, p.lineWrapCharacterLimit-nIndent)
|
||||||
}
|
}
|
||||||
|
|
||||||
var builder strings.Builder
|
var builder strings.Builder
|
||||||
|
|
||||||
for i, line := range lines {
|
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 {
|
if i < len(lines)-1 {
|
||||||
builder.WriteString(separator)
|
builder.WriteString(separator)
|
||||||
|
|
Loading…
Reference in a new issue