NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/45451: less(1) rings the terminal bell when searching

>Number:         45451
>Category:       bin
>Synopsis:       less(1) rings the terminal bell when searching
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 10 17:10:00 +0000 2011
>Originator:     M. Levinson
>Release:        NetBSD 5.99.55 from 2011-09-22
     $NetBSD: jump.c,v 1.2 2011/07/03 19:51:26 tron Exp $
Architecture: x86_64
Machine: amd64
        Forward-searching for a string that appears in the first displayed
        line causes less to ring the terminal bell.

        The patch below fixes the problem by preventing less from trying
        to scroll back zero lines when nline equals zero in the jump_loc()
        function (which probably couldn't happen in previous versions of
        less, but can occur in the recently-imported version 444 because
        searches now include the first line displayed on the screen).

        I've also submitted this patch to the upstream maintainer.

        % echo hello >testfile
        % env LESS= less testfile
        then search for the string hello with the command "/hello"


--- src/external/bsd/less/dist/jump.c
+++ src/external/bsd/less/dist/jump.c
@@ -197,7 +197,7 @@ jump_loc(pos, sline)
                nline -= sline;
                if (nline > 0)
                        forw(nline, position(BOTTOM_PLUS_ONE), 1, 0, 0);
-               else
+               else if (nline < 0)
                        back(-nline, position(TOP), 1, 0);
                if (show_attn)

Home | Main Index | Thread Index | Old Index