summaryrefslogtreecommitdiff
path: root/viewport/viewport.go
diff options
context:
space:
mode:
Diffstat (limited to 'viewport/viewport.go')
-rw-r--r--viewport/viewport.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/viewport/viewport.go b/viewport/viewport.go
index 7b897e7..da7832e 100644
--- a/viewport/viewport.go
+++ b/viewport/viewport.go
@@ -17,7 +17,15 @@ func Process(input string, height int) string {
cropped, top, bottom := Crop(input, lines, height)
return WithScroll(cropped, int(top*float32(height)), int(bottom*float32(height)))
}
- return input
+ return TrimSpaceRight(input)
+}
+
+func TrimSpaceRight(input string) string {
+ lines := strings.Split(input, "\n")
+ for i, l := range lines {
+ lines[i] = strings.TrimRight(l, " ")
+ }
+ return strings.Join(lines, "\n")
}
func Focus(lines []string, needle string) int {