From df9920c11ca46a29f480f322151b14a7ce4d5759 Mon Sep 17 00:00:00 2001 From: Johan Walles Date: Sat, 3 Aug 2019 20:14:22 +0200 Subject: [PATCH] Add scroll-right markers For lines extending to the right of the screen width. --- README.md | 17 ++++++++++------- m/pager.go | 7 +++++++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 4f6a9ba..55f4628 100644 --- a/README.md +++ b/README.md @@ -89,13 +89,6 @@ FIXME: Go release instructions TODO ---- -* Add '>' markers at the end of lines being cut because they are too long - -* Doing moar on an arbitrary binary (like /bin/ls) should put all - line-continuation markers at the rightmost column. This really - means our truncation code must work even with things like tabs and - various control characters. - * Make sure search hits are highlighted even when we have to scroll right to see them @@ -138,3 +131,13 @@ TODO * Retain the search string when pressing / to search a second time. * Make sure "git grep" output gets highlighted properly. + +Done +---- + +* Add '>' markers at the end of lines being cut because they are too long + +* Doing moar on an arbitrary binary (like /bin/ls) should put all + line-continuation markers at the rightmost column. This really + means our truncation code must work even with things like tabs and + various control characters. diff --git a/m/pager.go b/m/pager.go index 465b57c..94fa4d1 100644 --- a/m/pager.go +++ b/m/pager.go @@ -111,6 +111,13 @@ func (p *_Pager) _AddLine(logger *log.Logger, lineNumber int, line string) { matchRanges := GetMatchRanges(plainString, p.searchPattern) for _, token := range tokens[p.leftColumnZeroBased:] { + width, _ := p.screen.Size() + if pos >= width { + // Indicate that this line continues to the right + p.screen.SetContent(pos-1, lineNumber, '>', nil, tcell.StyleDefault.Reverse(true)) + break + } + style := token.Style if matchRanges.InRange(pos) { // FIXME: This doesn't work if the style is already reversed