Skip to content
Snippets Groups Projects
Unverified Commit 751aa194 authored by Junegunn Choi's avatar Junegunn Choi
Browse files

Remove trailing whitespaces when using --with-nth

parent 05b5f3f8
No related branches found
No related tags found
No related merge requests found
......@@ -126,6 +126,7 @@ func Run(opts *Options, revision string) {
return false
}
item.text, item.colors = ansiProcessor([]byte(transformed))
item.text.TrimTrailingWhitespaces()
item.text.Index = itemIndex
item.origText = &data
itemIndex++
......
......@@ -142,6 +142,11 @@ func (chars *Chars) TrailingWhitespaces() int {
return whitespaces
}
func (chars *Chars) TrimTrailingWhitespaces() {
whitespaces := chars.TrailingWhitespaces()
chars.slice = chars.slice[0 : len(chars.slice)-whitespaces]
}
func (chars *Chars) ToString() string {
if runes := chars.optionalRunes(); runes != nil {
return string(runes)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment