wuffsfmt: double-indents hanging lines

This commit is contained in:
Nigel Tao committed 2023-04-09 15:22:25 +10:00
1 parent d910658bce
commit 9c03b8c71d
2 files changed
+10 -2

No files matched your search

+8
View File
@@ -1,6 +1,14 @@
# Changelog
## Work In Progress
The dot points below probably aren't of interest unless you're _writing_ Wuffs
code (instead of writing C/C++ code that _uses_ Wuffs' standard library).
- `wuffsfmt` double-indents hanging lines.
## 2023-04-08 version 0.3.3
The `wuffs_base__parse_number_f64` function has been further optimized.
+2 -2
View File
@@ -65,7 +65,7 @@ func Render(w io.Writer, tm *t.Map, src []t.Token, comments []string) (err error
// Print any previous comments.
commentIndent := indent
if prevLineHanging {
commentIndent++
commentIndent += 2
}
for ; commentLine < line; commentLine++ {
buf = buf[:0]
@@ -115,7 +115,7 @@ func Render(w io.Writer, tm *t.Map, src []t.Token, comments []string) (err error
} else if id.IsClose() {
indentAdjustment--
} else if hanging && ((id != t.IDOpenCurly) && (id != t.IDOpenDoubleCurly)) {
indentAdjustment++
indentAdjustment += 2
}
buf = appendTabs(buf, indent+indentAdjustment)