1
1
mirror of https://github.com/walles/moar.git synced 2024-11-27 01:05:23 +03:00

Add "---" as an EOF-marker for short files

This commit is contained in:
Johan Walles 2019-08-04 07:15:35 +02:00
parent 5bb74e4f10
commit 19f477b8e7
2 changed files with 10 additions and 4 deletions

View File

@ -89,9 +89,6 @@ FIXME: Go release instructions
TODO
----
* Change out-of-file visualization to writing --- after the end of the
file and leaving the rest of the screen blank.
* Exit search on pressing up / down / pageup / pagedown keys and
scroll. I attempted to do that spontaneously, so it's probably a
good idea.
@ -141,3 +138,6 @@ Done
* Make sure search hits are highlighted even when we have to scroll right
to see them
* Change out-of-file visualization to writing --- after the end of the
file and leaving the rest of the screen blank.

View File

@ -44,6 +44,8 @@ type _PreHelpState struct {
leftColumnZeroBased int
}
const _EofMarker = "\x1b[7m---" // Reverse video "---""
var _HelpReader = NewReaderFromText("Help", `
Welcome to Moar, the nice pager!
@ -162,10 +164,14 @@ func (p *_Pager) _AddLines(logger *log.Logger) {
// display starts scrolling visibly.
p.firstLineOneBased = lines.firstLineOneBased
for screenLineNumber, line := range lines.lines {
screenLineNumber := 0
for _, line := range lines.lines {
p._AddLine(logger, screenLineNumber, line)
screenLineNumber++
}
p._AddLine(logger, screenLineNumber, _EofMarker)
switch p.mode {
case _Searching:
p._AddSearchFooter()