NetBSD Problem Report #45451

From mlevins@users.sourceforge.net  Mon Oct 10 17:09:20 2011
Return-Path: <mlevins@users.sourceforge.net>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 31C1D63B955
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 10 Oct 2011 17:09:20 +0000 (UTC)
Message-Id: <9975.1318252366@poultrygeist.com>
Date: Mon, 10 Oct 2011 09:14:25 -0400 (EDT)
From: "M. Levinson" <mlevins@users.sourceforge.net>
Reply-To: "M. Levinson" <mlevins@users.sourceforge.net>
To: gnats-bugs@gnats.NetBSD.org
Subject: less(1) rings the terminal bell when searching
X-Send-Pr-Version: 3.95

>Number:         45451
>Category:       bin
>Synopsis:       less(1) rings the terminal bell when searching
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    tron
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 10 17:10:00 +0000 2011
>Closed-Date:    Wed Sep 04 20:06:44 +0000 2013
>Last-Modified:  Wed Sep 04 20:06:44 +0000 2013
>Originator:     M. Levinson
>Release:        NetBSD 5.99.55 from 2011-09-22
>Organization:
>Environment:
     $NetBSD: jump.c,v 1.2 2011/07/03 19:51:26 tron Exp $
Architecture: x86_64
Machine: amd64
>Description:
	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.

>How-To-Repeat:
	% echo hello >testfile
	% env LESS= less testfile
	then search for the string hello with the command "/hello"

>Fix:

--- 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 HILITE_SEARCH
 		if (show_attn)

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: bin-bug-people->tron
Responsible-Changed-By: tron@NetBSD.org
Responsible-Changed-When: Wed, 04 Sep 2013 19:59:28 +0000
Responsible-Changed-Why:
I'll handle this PR.


From: "Matthias Scheler" <tron@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/45451 CVS commit: src/external/bsd/less/dist
Date: Wed, 4 Sep 2013 20:02:11 +0000

 Module Name:	src
 Committed By:	tron
 Date:		Wed Sep  4 20:02:10 UTC 2013

 Modified Files:
 	src/external/bsd/less/dist: jump.c

 Log Message:
 Don't ring the terminal bell if the user forward-searches for a string
 that appears in the first displayed line.

 This patch was supplied by M. Levinson in PR bin/45451.


 To generate a diff of this commit:
 cvs rdiff -u -r1.3 -r1.4 src/external/bsd/less/dist/jump.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: tron@NetBSD.org
State-Changed-When: Wed, 04 Sep 2013 20:06:44 +0000
State-Changed-Why:
I've comitted your patch. Thanks a lot for the contribution.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.