less: add a function to detect when display is at end of file
authorRon Yorston <rmy@pobox.com>
Fri, 24 Jul 2015 13:28:50 +0000 (14:28 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Fri, 31 Jul 2015 14:22:08 +0000 (16:22 +0200)
commitad1b4d5882586ad213992a97fc22f9c4bc9e0040
tree10a3ee4cbfc543a506f52e1f316898a1428df005
parent70b84be9e85969491e542cecc3ae28fa7558a7ec
less: add a function to detect when display is at end of file

Add a function to package the test that detects whether enough has
been read from the file to allow a screenful to be displayed.

Also use this to determine when to display '(END)' in the status
line.  The previous code was incomplete and didn't handle truncated
lines (-S flag) properly.

function                                             old     new   delta
at_end                                                 -      63     +63
status_print                                         111     109      -2
read_lines                                           819     764     -55
getch_nowait                                         319     264     -55
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/3 up/down: 63/-112)           Total: -49 bytes

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
miscutils/less.c