mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-10-27 11:39:57 -04:00
Fixed rune handling in IndentWriter
This commit is contained in:
1 parent
8ecdd0e83c
commit
340f345efe
1 file changed
+5
-1
@@ -14,6 +14,10 @@ type IndentWriter struct {
|
|||||||
|
|
||||||
// Write is used to write content to the indent buffer.
|
// Write is used to write content to the indent buffer.
|
||||||
func (w *IndentWriter) Write(b []byte) (int, error) {
|
func (w *IndentWriter) Write(b []byte) (int, error) {
|
||||||
|
if w.Indent == 0 {
|
||||||
|
return w.Forward.Write(b)
|
||||||
|
}
|
||||||
|
|
||||||
for _, c := range string(b) {
|
for _, c := range string(b) {
|
||||||
if !w.skipIndent {
|
if !w.skipIndent {
|
||||||
_, err := w.Forward.Write([]byte(strings.Repeat(" ", int(w.Indent))))
|
_, err := w.Forward.Write([]byte(strings.Repeat(" ", int(w.Indent))))
|
||||||
@@ -23,7 +27,7 @@ func (w *IndentWriter) Write(b []byte) (int, error) {
|
|||||||
w.skipIndent = true
|
w.skipIndent = true
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := w.Forward.Write([]byte{byte(c)})
|
_, err := w.Forward.Write([]byte(string(c)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user