Perform some cleaning operations on line breaks. (#11720)
Co-authored-by: André Storfjord Kristiansen <33384479+dev-bio@users.noreply.github.com>
This commit is contained in:
parent
1a13bf5c0d
commit
c102e0b930
1 changed files with 14 additions and 0 deletions
|
@ -136,6 +136,13 @@ func cleanConf(in, out *bytes.Buffer) error {
|
|||
case ' ', '\t':
|
||||
needOutput = lineStarted
|
||||
case '\r':
|
||||
rest := in.Bytes()
|
||||
if len(rest) > 0 {
|
||||
if rest[0] != '\n' {
|
||||
c = ' '
|
||||
needOutput = lineStarted
|
||||
}
|
||||
}
|
||||
case '\n':
|
||||
needOutput = !(!lineStarted && emptyLineWritten)
|
||||
nextLineStarted = false
|
||||
|
@ -150,6 +157,13 @@ func cleanConf(in, out *bytes.Buffer) error {
|
|||
case stateComment:
|
||||
switch c {
|
||||
case '\r':
|
||||
rest := in.Bytes()
|
||||
if len(rest) > 0 {
|
||||
if rest[0] != '\n' {
|
||||
c = ' '
|
||||
needOutput = lineStarted
|
||||
}
|
||||
}
|
||||
case '\n':
|
||||
needOutput = true
|
||||
nextLineStarted = false
|
||||
|
|
Loading…
Reference in a new issue