Change the behaviour when in `more' mode (less invoked as more):

* Treat search patterns as BREs only, per 1003.2 and XCU5.
* Do not perform any special treatment when an unqoted * or @ is given as
  the first character of the search pattern.
Addresses PR bin/8269 by Chris Demetriou.
This commit is contained in:
kleink 1999-09-03 22:07:05 +00:00
parent a9beb821ed
commit edafa96ea6
4 changed files with 20 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: command.c,v 1.6 1999/04/06 05:57:35 mrg Exp $ */
/* $NetBSD: command.c,v 1.7 1999/09/03 22:07:05 kleink Exp $ */
/*
* Copyright (c) 1984,1985,1989,1994,1995,1996,1999 Mark Nudelman
@ -52,6 +52,7 @@ extern int ignore_eoi;
extern int secure;
extern int hshift;
extern int show_attn;
extern int more_mode;
extern char *every_first_cmd;
extern char *curr_altfilename;
extern char version[];
@ -346,8 +347,8 @@ mca_char(c)
* Certain characters as the first char of
* the pattern have special meaning:
* ! Toggle the NO_MATCH flag
* * Toggle the PAST_EOF flag
* @ Toggle the FIRST_FILE flag
* * Toggle the PAST_EOF flag (less extension)
* @ Toggle the FIRST_FILE flag (less extension)
*/
if (len_cmdbuf() > 0)
/*
@ -358,12 +359,16 @@ mca_char(c)
flag = 0;
switch (c)
{
case CONTROL('E'): /* ignore END of file */
case '*':
if (more_mode)
break;
case CONTROL('E'): /* ignore END of file */
flag = SRCH_PAST_EOF;
break;
case CONTROL('F'): /* FIRST file */
case '@':
if (more_mode)
break;
case CONTROL('F'): /* FIRST file */
flag = SRCH_FIRST_FILE;
break;
case CONTROL('K'): /* KEEP position */

View File

@ -1,4 +1,4 @@
/* $NetBSD: help.c,v 1.1.1.4 1999/04/06 05:30:34 mrg Exp $ */
/* $NetBSD: help.c,v 1.2 1999/09/03 22:07:06 kleink Exp $ */
/* This file was generated by mkhelp from less.hlp */
#include "less.h"
@ -50,6 +50,7 @@ constant char helpdata[] = {
' ',' ',' ',' ',' ',' ',' ',' ','^','F',' ','o','r',' ','@',' ',' ','S','t','a','r','t',' ','s','e','a','r','c','h',' ','a','t',' ','F','I','R','S','T',' ','f','i','l','e',' ','(','f','o','r',' ','/',')',' ','o','r',' ','l','a','s','t',' ','f','i','l','e',' ','(','f','o','r',' ','?',')','.','\n',
' ',' ',' ',' ',' ',' ',' ',' ','^','K',' ',' ',' ',' ',' ',' ',' ','H','i','g','h','l','i','g','h','t',' ','m','a','t','c','h','e','s',',',' ','b','u','t',' ','d','o','n','\'','t',' ','m','o','v','e',' ','(','K','E','E','P',' ','p','o','s','i','t','i','o','n',')','.','\n',
' ',' ',' ',' ',' ',' ',' ',' ','^','R',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','u','s','e',' ','R','E','G','U','L','A','R',' ','E','X','P','R','E','S','S','I','O','N','S','.','\n',
' ',' ',' ',' ',' ',' ',' ',' ','*',' ','a','n','d',' ','@',' ','m','o','d','i','f','i','e','r','s',' ','a','r','e',' ','r','e','c','o','g','n','i','z','e','d',' ','i','n',' ','l','e','s','s',' ','m','o','d','e',' ','o','n','l','y','.','\n',
' ','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\n',
'\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','J','\b','J','U','\b','U','M','\b','M','P','\b','P','I','\b','I','N','\b','N','G','\b','G','\n',

View File

@ -1,4 +1,4 @@
.\" $NetBSD: less.1,v 1.8 1999/08/02 12:41:20 sommerfeld Exp $
.\" $NetBSD: less.1,v 1.9 1999/09/03 22:07:06 kleink Exp $
.\"
.TH LESS 1 "Version 335: 03 Apr 1999"
.SH NAME
@ -174,7 +174,8 @@ Same as single quote.
.IP /pattern
Search forward in the file for the N-th line containing the pattern.
N defaults to 1.
The pattern is a regular expression, as recognized by
When invoked as less, the pattern is an extended regular expression.
Otherwise, the pattern is a basic regular expression, as recognized by
.I ed.
The search starts at the second line displayed
(but see the -a and -j options, which change this).
@ -190,11 +191,13 @@ Search multiple files.
That is, if the search reaches the END of the current file
without finding a match,
the search continues in the next file in the command line list.
The * modifier is available when invoked as less only.
.IP "^F or @"
Begin the search at the first line of the FIRST file
in the command line list,
regardless of what is currently displayed on the screen
or the settings of the -a or -j options.
The @ modifier is available when invoked as less only.
.IP "^K"
Highlight any text which matches the pattern on the current screen,
but don't move to the first match (KEEP current position).

View File

@ -1,4 +1,4 @@
/* $NetBSD: search.c,v 1.3 1999/04/06 05:57:36 mrg Exp $ */
/* $NetBSD: search.c,v 1.4 1999/09/03 22:07:06 kleink Exp $ */
/*
* Copyright (c) 1984,1985,1989,1994,1995,1996,1999 Mark Nudelman
@ -40,7 +40,7 @@
#if HAVE_POSIX_REGCOMP
#include <regex.h>
#ifdef REG_EXTENDED
#define REGCOMP_FLAG REG_EXTENDED
#define REGCOMP_FLAG (more_mode ? 0 : REG_EXTENDED)
#else
#define REGCOMP_FLAG 0
#endif
@ -81,6 +81,7 @@ extern int linenums;
extern int sc_height;
extern int jump_sline;
extern int bs_mode;
extern int more_mode;
extern POSITION start_attnpos;
extern POSITION end_attnpos;
#if HILITE_SEARCH