From d1633e905a1487e8845088c03db8faf53d587e46 Mon Sep 17 00:00:00 2001 From: ewy Date: Sat, 2 May 2026 19:08:49 +0200 Subject: trim right side space in viewport --- viewport/viewport.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'viewport') 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 { -- cgit v1.3.1