[PATCH] less: correctly account for tabs when rewrapping lines
Denys Vlasenko
vda.linux at googlemail.com
Sun Jul 19 20:53:13 UTC 2015
Applied, thanks!
On Sun, Jul 19, 2015 at 10:41 PM, Ron Yorston <rmy at frippery.org> wrote:
> Lines are rewrapped when the terminal width changes or line numbers
> are enabled/disabled. The current calculation always adds eight to
> the line length for a tab whereas it should only add enough to move
> to the next tab stop.
>
> This doesn't affect the display of lines, which is handled elsewhere
> and gets tab stops right, but it does cause lines to be wrapped at
> the wrong position.
>
> Signed-off-by: Ron Yorston <rmy at pobox.com>
> ---
> miscutils/less.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/miscutils/less.c b/miscutils/less.c
> index 7c46ba5..90c1038 100644
> --- a/miscutils/less.c
> +++ b/miscutils/less.c
> @@ -331,8 +331,10 @@ static void re_wrap(void)
> *d = *s;
> if (*d != '\0') {
> new_line_pos++;
> - if (*d == '\t') /* tab */
> + if (*d == '\t') { /* tab */
> new_line_pos += 7;
> + new_line_pos &= (~7);
> + }
> s++;
> d++;
> if (new_line_pos >= w) {
> --
> 2.4.3
>
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
More information about the busybox
mailing list