less: fix line number confusion
authorRon Yorston <rmy@pobox.com>
Fri, 24 Jul 2015 13:29:13 +0000 (14:29 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Fri, 31 Jul 2015 14:22:08 +0000 (16:22 +0200)
commitd542d183e10dde1168fa85751194839c67add7fe
tree12ceebe88914fb3c5686ffd6cf48812aa072aa8d
parentad1b4d5882586ad213992a97fc22f9c4bc9e0040
less: fix line number confusion

Much of the code refers to lines using indices into the flines
array (which splits lines into portions that fit on the terminal).
In some cases this is wrong and actual line numbers should be
used:

- when lines are being truncated rather than wrapped (-S flag)
- when line numbers have been entered by the user

Also fix a bug in numeric input and improve the display at EOF.

function                                             old     new   delta
goto_lineno                                            -     111    +111
cap_cur_fline                                          -     101    +101
buffer_to_line                                         -      56     +56
buffer_up                                             35      66     +31
less_main                                           2606    2615      +9
goto_match                                           125     127      +2
buffer_down                                           81      56     -25
buffer_line                                           64       -     -64
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 3/1 up/down: 310/-89)           Total: 221 bytes

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