diff --git a/pager/command.go b/pager/command.go index 0b4fd45..47f6182 100644 --- a/pager/command.go +++ b/pager/command.go @@ -2,6 +2,7 @@ package pager import ( "fmt" + "regexp" "github.com/alecthomas/kong" "github.com/charmbracelet/bubbles/viewport" @@ -22,7 +23,9 @@ func (o Options) Run() error { return fmt.Errorf("unable to read stdin") } if stdin != "" { - o.Content = stdin + // Sanitize the input from stdin by removing backspace sequences. + backspace := regexp.MustCompile(".\x08") + o.Content = backspace.ReplaceAllString(stdin, "") } else { return fmt.Errorf("provide some content to display") }