Skip to content

Dedent incorrectly removes spaces that aren't at the start of a line #72

@dadgar

Description

@dadgar

When a string has lines with no indentation and lines with indentations, the dedented string will remove the first spaces within the line instead of just at the start.

package main

import (
	"fmt"

	"github.com/muesli/reflow/dedent"
)

func main() {
	input := `This is an example
	
  with no shared indent.`
	fmt.Println(dedent.String(input))
}

The output will be:

Thisisan example

with no shared indent.

https://go.dev/play/p/Q13CeRD8Tb2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions