mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-26 17:01:35 +01:00
wuffsfmt: indent with 4 spaces (not a tab)
This commit is contained in:
1 parent
9c03b8c71d
commit
f5eb38d76e
2 files changed
+13
-7
No files matched your search
+2
-1
@@ -6,7 +6,8 @@
|
||||
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.
|
||||
- `wuffsfmt` double-indents hanging lines and each indent is now 4 spaces (not
|
||||
a tab).
|
||||
|
||||
|
||||
## 2023-04-08 version 0.3.3
|
||||
|
||||
+11
-6
@@ -294,13 +294,18 @@ func appendNum(buf []byte, s string) []byte {
|
||||
return buf
|
||||
}
|
||||
|
||||
func appendTabs(buf []byte, n int) []byte {
|
||||
if n > 0 {
|
||||
const tabs = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"
|
||||
for ; n > len(tabs); n -= len(tabs) {
|
||||
buf = append(buf, tabs...)
|
||||
func appendTabs(buf []byte, nTabs int) []byte {
|
||||
nSpaces := 4 * nTabs // Hard-code 4 spaces per tab.
|
||||
if nSpaces > 0 {
|
||||
const spaces = "" + // 256 spaces.
|
||||
" " +
|
||||
" " +
|
||||
" " +
|
||||
" "
|
||||
for ; nSpaces > len(spaces); nSpaces -= len(spaces) {
|
||||
buf = append(buf, spaces...)
|
||||
}
|
||||
buf = append(buf, tabs[:n]...)
|
||||
buf = append(buf, spaces[:nSpaces]...)
|
||||
}
|
||||
return buf
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user