summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2019-11-12 22:45:25 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2019-11-12 23:20:09 +0900
commit751aa1944ae7fd1d8d1a12cc622f77cde160bb52 (patch)
treedb21f7426ca5383c1c4e0c551510c31a3e11b14f /src/util
parent05b5f3f845a88e9b034f3302bb50672fc5b7f8c7 (diff)
Remove trailing whitespaces when using --with-nth
Diffstat (limited to 'src/util')
-rw-r--r--src/util/chars.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/util/chars.go b/src/util/chars.go
index e36ab769..a57ba4bb 100644
--- a/src/util/chars.go
+++ b/src/util/chars.go
@@ -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)