* The -D option with one number now means use the normal background color.
* Don't change permissions on history file if it is not a regular file.
* Fix non-ANSI-compliant code that caused problems with some compilers.
* Fix binary file detection in UTF-8 mode.
* Fix display problems with long lines on "ignaw" terminals.
* Fix problem interrupting the line number calculation for initial prompt.
* Fix SGR emulation when dealing with multiple attributes (eg.
bold+underline).
* Fix highlight bug when searching for underlined/overstruck text.
* New "&" command allows filtering of lines based on a pattern.
* Status column now displays a search match, even if the matched string is
scrolled off screen because -S is in effect.
* Improve behavior of -F option.
* Allow CSI character (0x9B) to work in UTF-8 mode.
* Output carriage return at startup in case terminal doesn't default to
column 1.
* Fix bug in '' (quote, quote) command after G command.
------------
Less
-Copyright (C) 1984-2007 Mark Nudelman
+Copyright (C) 1984-2008 Mark Nudelman
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
======================================================================
+ Major changes between "less" versions 424 and 429
+
+* LESSOPEN pipe will now be used on standard input, if the LESSOPEN
+ environment variable begins with "|-".
+
+* The -D option with one number now means use the normal background color.
+
+* Don't change permissions on history file if it is not a regular file.
+
+* Fix non-ANSI-compliant code that caused problems with some compilers.
+
+* Fix binary file detection in UTF-8 mode.
+
+* Fix display problems with long lines on "ignaw" terminals.
+
+* Fix problem interrupting the line number calculation for initial prompt.
+
+* Fix SGR emulation when dealing with multiple attributes (eg. bold+underline).
+
+* Fix highlight bug when searching for underlined/overstruck text.
+
+======================================================================
+
+ Major changes between "less" versions 418 and 424
+
+* New "&" command allows filtering of lines based on a pattern.
+
+* Status column now displays a search match, even if the matched
+ string is scrolled off screen because -S is in effect.
+
+* Improve behavior of -F option.
+
+* Allow CSI character (0x9B) to work in UTF-8 mode.
+
+* Output carriage return at startup in case terminal doesn't default
+ to column 1.
+
+* Fix bug in '' (quote, quote) command after G command.
+
+======================================================================
Major changes between "less" versions 416 and 418
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
* in order from most- to least-recently used.
* The circular list is anchored by the file state "thisfile".
*/
+struct bufnode {
+ struct bufnode *next, *prev;
+ struct bufnode *hnext, *hprev;
+};
+
#define LBUFSIZE 8192
struct buf {
- struct buf *next, *prev;
- struct buf *hnext, *hprev;
+ struct bufnode node;
BLOCKNUM block;
unsigned int datasize;
unsigned char data[LBUFSIZE];
};
-
-struct buflist {
- /* -- Following members must match struct buf */
- struct buf *buf_next, *buf_prev;
- struct buf *buf_hnext, *buf_hprev;
-};
+#define bufnode_buf(bn) ((struct buf *) bn)
/*
* The file state is maintained in a filestate structure.
*/
#define BUFHASH_SIZE 64
struct filestate {
- struct buf *buf_next, *buf_prev;
- struct buflist hashtbl[BUFHASH_SIZE];
+ struct bufnode buflist;
+ struct bufnode hashtbl[BUFHASH_SIZE];
int file;
int flags;
POSITION fpos;
POSITION fsize;
};
-#define ch_bufhead thisfile->buf_next
-#define ch_buftail thisfile->buf_prev
+#define ch_bufhead thisfile->buflist.next
+#define ch_buftail thisfile->buflist.prev
#define ch_nbufs thisfile->nbufs
#define ch_block thisfile->block
#define ch_offset thisfile->offset
#define ch_flags thisfile->flags
#define ch_file thisfile->file
-#define END_OF_CHAIN ((struct buf *)&thisfile->buf_next)
-#define END_OF_HCHAIN(h) ((struct buf *)&thisfile->hashtbl[h])
+#define END_OF_CHAIN (&thisfile->buflist)
+#define END_OF_HCHAIN(h) (&thisfile->hashtbl[h])
#define BUFHASH(blk) ((blk) & (BUFHASH_SIZE-1))
-#define FOR_BUFS_IN_CHAIN(h,bp) \
- for (bp = thisfile->hashtbl[h].buf_hnext; \
- bp != END_OF_HCHAIN(h); bp = bp->hnext)
+/*
+ * Macros to manipulate the list of buffers in thisfile->buflist.
+ */
+#define FOR_BUFS(bn) \
+ for (bn = ch_bufhead; bn != END_OF_CHAIN; bn = bn->next)
+
+#define BUF_RM(bn) \
+ (bn)->next->prev = (bn)->prev; \
+ (bn)->prev->next = (bn)->next;
+
+#define BUF_INS_HEAD(bn) \
+ (bn)->next = ch_bufhead; \
+ (bn)->prev = END_OF_CHAIN; \
+ ch_bufhead->prev = (bn); \
+ ch_bufhead = (bn);
+
+#define BUF_INS_TAIL(bn) \
+ (bn)->next = END_OF_CHAIN; \
+ (bn)->prev = ch_buftail; \
+ ch_buftail->next = (bn); \
+ ch_buftail = (bn);
+
+/*
+ * Macros to manipulate the list of buffers in thisfile->hashtbl[n].
+ */
+#define FOR_BUFS_IN_CHAIN(h,bn) \
+ for (bn = thisfile->hashtbl[h].hnext; \
+ bn != END_OF_HCHAIN(h); bn = bn->hnext)
-#define HASH_RM(bp) \
- (bp)->hnext->hprev = (bp)->hprev; \
- (bp)->hprev->hnext = (bp)->hnext;
+#define BUF_HASH_RM(bn) \
+ (bn)->hnext->hprev = (bn)->hprev; \
+ (bn)->hprev->hnext = (bn)->hnext;
-#define HASH_INS(bp,h) \
- (bp)->hnext = thisfile->hashtbl[h].buf_hnext; \
- (bp)->hprev = END_OF_HCHAIN(h); \
- thisfile->hashtbl[h].buf_hnext->hprev = (bp); \
- thisfile->hashtbl[h].buf_hnext = (bp);
+#define BUF_HASH_INS(bn,h) \
+ (bn)->hnext = thisfile->hashtbl[h].hnext; \
+ (bn)->hprev = END_OF_HCHAIN(h); \
+ thisfile->hashtbl[h].hnext->hprev = (bn); \
+ thisfile->hashtbl[h].hnext = (bn);
static struct filestate *thisfile;
static int ch_ungotchar = -1;
/*
* Get the character pointed to by the read pointer.
- * ch_get() is a macro which is more efficient to call
- * than fch_get (the function), in the usual case
- * that the block desired is at the head of the chain.
*/
-#define ch_get() ((ch_block == ch_bufhead->block && \
- ch_offset < ch_bufhead->datasize) ? \
- ch_bufhead->data[ch_offset] : fch_get())
int
-fch_get()
+ch_get()
{
register struct buf *bp;
+ register struct bufnode *bn;
register int n;
register int slept;
register int h;
if (thisfile == NULL)
return (EOI);
+ /*
+ * Quick check for the common case where
+ * the desired char is in the head buffer.
+ */
+ if (ch_bufhead != END_OF_CHAIN)
+ {
+ bp = bufnode_buf(ch_bufhead);
+ if (ch_block == bp->block && ch_offset < bp->datasize)
+ return bp->data[ch_offset];
+ }
+
slept = FALSE;
/*
* Look for a buffer holding the desired block.
*/
h = BUFHASH(ch_block);
- FOR_BUFS_IN_CHAIN(h, bp)
+ FOR_BUFS_IN_CHAIN(h, bn)
{
+ bp = bufnode_buf(bn);
if (bp->block == ch_block)
{
if (ch_offset >= bp->datasize)
/*
* Need more data in this buffer.
*/
- goto read_more;
+ break;
goto found;
}
}
- /*
- * Block is not in a buffer.
- * Take the least recently used buffer
- * and read the desired block into it.
- * If the LRU buffer has data in it,
- * then maybe allocate a new buffer.
- */
- if (ch_buftail == END_OF_CHAIN || ch_buftail->block != -1)
+ if (bn == END_OF_HCHAIN(h))
{
/*
- * There is no empty buffer to use.
- * Allocate a new buffer if:
- * 1. We can't seek on this file and -b is not in effect; or
- * 2. We haven't allocated the max buffers for this file yet.
+ * Block is not in a buffer.
+ * Take the least recently used buffer
+ * and read the desired block into it.
+ * If the LRU buffer has data in it,
+ * then maybe allocate a new buffer.
*/
- if ((autobuf && !(ch_flags & CH_CANSEEK)) ||
- (maxbufs < 0 || ch_nbufs < maxbufs))
- if (ch_addbuf())
- /*
- * Allocation failed: turn off autobuf.
- */
- autobuf = OPT_OFF;
+ if (ch_buftail == END_OF_CHAIN ||
+ bufnode_buf(ch_buftail)->block != -1)
+ {
+ /*
+ * There is no empty buffer to use.
+ * Allocate a new buffer if:
+ * 1. We can't seek on this file and -b is not in effect; or
+ * 2. We haven't allocated the max buffers for this file yet.
+ */
+ if ((autobuf && !(ch_flags & CH_CANSEEK)) ||
+ (maxbufs < 0 || ch_nbufs < maxbufs))
+ if (ch_addbuf())
+ /*
+ * Allocation failed: turn off autobuf.
+ */
+ autobuf = OPT_OFF;
+ }
+ bn = ch_buftail;
+ bp = bufnode_buf(bn);
+ BUF_HASH_RM(bn); /* Remove from old hash chain. */
+ bp->block = ch_block;
+ bp->datasize = 0;
+ BUF_HASH_INS(bn, h); /* Insert into new hash chain. */
}
- bp = ch_buftail;
- HASH_RM(bp); /* Remove from old hash chain. */
- bp->block = ch_block;
- bp->datasize = 0;
- HASH_INS(bp, h); /* Insert into new hash chain. */
read_more:
pos = (ch_block * LBUFSIZE) + bp->datasize;
}
found:
- if (ch_bufhead != bp)
+ if (ch_bufhead != bn)
{
/*
* Move the buffer to the head of the buffer chain.
* This orders the buffer chain, most- to least-recently used.
*/
- bp->next->prev = bp->prev;
- bp->prev->next = bp->next;
- bp->next = ch_bufhead;
- bp->prev = END_OF_CHAIN;
- ch_bufhead->prev = bp;
- ch_bufhead = bp;
+ BUF_RM(bn);
+ BUF_INS_HEAD(bn);
/*
* Move to head of hash chain too.
*/
- HASH_RM(bp);
- HASH_INS(bp, h);
+ BUF_HASH_RM(bn);
+ BUF_HASH_INS(bn, h);
}
if (ch_offset >= bp->datasize)
sync_logfile()
{
register struct buf *bp;
+ register struct bufnode *bn;
int warned = FALSE;
BLOCKNUM block;
BLOCKNUM nblocks;
nblocks = (ch_fpos + LBUFSIZE - 1) / LBUFSIZE;
for (block = 0; block < nblocks; block++)
{
- for (bp = ch_bufhead; ; bp = bp->next)
+ int wrote = FALSE;
+ FOR_BUFS(bn)
{
- if (bp == END_OF_CHAIN)
- {
- if (!warned)
- {
- error("Warning: log file is incomplete",
- NULL_PARG);
- warned = TRUE;
- }
- break;
- }
+ bp = bufnode_buf(bn);
if (bp->block == block)
{
write(logfile, (char *) bp->data, bp->datasize);
+ wrote = TRUE;
break;
}
}
+ if (!wrote && !warned)
+ {
+ error("Warning: log file is incomplete",
+ NULL_PARG);
+ warned = TRUE;
+ }
}
}
BLOCKNUM block;
{
register struct buf *bp;
+ register struct bufnode *bn;
register int h;
h = BUFHASH(block);
- FOR_BUFS_IN_CHAIN(h, bp)
+ FOR_BUFS_IN_CHAIN(h, bn)
{
+ bp = bufnode_buf(bn);
if (bp->block == block)
return (TRUE);
}
public int
ch_beg_seek()
{
- register struct buf *bp, *firstbp;
+ register struct bufnode *bn;
+ register struct bufnode *firstbn;
/*
* Try a plain ch_seek first.
* Can't get to position 0.
* Look thru the buffers for the one closest to position 0.
*/
- firstbp = bp = ch_bufhead;
- if (bp == END_OF_CHAIN)
+ firstbn = ch_bufhead;
+ if (firstbn == END_OF_CHAIN)
return (1);
- while ((bp = bp->next) != END_OF_CHAIN)
- if (bp->block < firstbp->block)
- firstbp = bp;
- ch_block = firstbp->block;
+ FOR_BUFS(bn)
+ {
+ if (bufnode_buf(bn)->block < bufnode_buf(firstbn)->block)
+ firstbn = bn;
+ }
+ ch_block = bufnode_buf(firstbn)->block;
ch_offset = 0;
return (0);
}
public void
ch_flush()
{
- register struct buf *bp;
+ register struct bufnode *bn;
if (thisfile == NULL)
return;
/*
* Initialize all the buffers.
*/
- for (bp = ch_bufhead; bp != END_OF_CHAIN; bp = bp->next)
- bp->block = -1;
+ FOR_BUFS(bn)
+ {
+ bufnode_buf(bn)->block = -1;
+ }
/*
* Figure out the size of the file, if we can.
ch_addbuf()
{
register struct buf *bp;
+ register struct bufnode *bn;
/*
* Allocate and initialize a new buffer and link it
return (1);
ch_nbufs++;
bp->block = -1;
- bp->next = END_OF_CHAIN;
- bp->prev = ch_buftail;
- ch_buftail->next = bp;
- ch_buftail = bp;
- HASH_INS(bp, 0);
+ bn = &bp->node;
+
+ BUF_INS_TAIL(bn);
+ BUF_HASH_INS(bn, 0);
return (0);
}
for (h = 0; h < BUFHASH_SIZE; h++)
{
- thisfile->hashtbl[h].buf_hnext = END_OF_HCHAIN(h);
- thisfile->hashtbl[h].buf_hprev = END_OF_HCHAIN(h);
+ thisfile->hashtbl[h].hnext = END_OF_HCHAIN(h);
+ thisfile->hashtbl[h].hprev = END_OF_HCHAIN(h);
}
}
static void
ch_delbufs()
{
- register struct buf *bp;
+ register struct bufnode *bn;
while (ch_bufhead != END_OF_CHAIN)
{
- bp = ch_bufhead;
- bp->next->prev = bp->prev;
- bp->prev->next = bp->next;
- free(bp);
+ bn = ch_bufhead;
+ BUF_RM(bn);
+ free(bufnode_buf(bn));
}
ch_nbufs = 0;
init_hashtbl();
*/
thisfile = (struct filestate *)
calloc(1, sizeof(struct filestate));
- thisfile->buf_next = thisfile->buf_prev = END_OF_CHAIN;
+ thisfile->buflist.next = thisfile->buflist.prev = END_OF_CHAIN;
thisfile->nbufs = 0;
thisfile->flags = 0;
thisfile->fpos = 0;
ch_dump(struct filestate *fs)
{
struct buf *bp;
+ struct bufnode *bn;
unsigned char *s;
if (fs == NULL)
fs->file, fs->flags, fs->fpos,
fs->fsize, fs->block, fs->offset);
printf(" %d bufs:\n", fs->nbufs);
- for (bp = fs->buf_next; bp != (struct buf *)fs; bp = bp->next)
+ for (bn = fs->next; bn != &fs->buflist; bn = bn->next)
{
+ bp = bufnode_buf(bn);
printf("%x: blk %x, size %x \"",
bp, bp->block, bp->datasize);
for (s = bp->data; s < bp->data + 30; s++)
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
*/
public int
binary_char(c)
- unsigned char c;
+ LWCHAR c;
{
+ if (utf_mode)
+ return (is_ubin_char(c));
c &= 0377;
return (chardef[c] & IS_BINARY_CHAR);
}
*/
public int
control_char(c)
- int c;
+ LWCHAR c;
{
c &= 0377;
return (chardef[c] & IS_CONTROL_CHAR);
*/
public char *
prchar(c)
- int c;
+ LWCHAR c;
{
/* {{ This buffer can be overrun if LESSBINFMT is a long string. }} */
static char buf[32];
* dated 2005-11-30T00:58:48Z
*/
static struct wchar_range ubin_table[] = {
- { 0x0000, 0x001F} /* Cc */, { 0x007F, 0x009F} /* Cc */,
+ { 0x0000, 0x0007} /* Cc */,
+ { 0x000B, 0x000C} /* Cc */,
+ { 0x000E, 0x001A} /* Cc */,
+ { 0x001C, 0x001F} /* Cc */,
+ { 0x007F, 0x009F} /* Cc */,
#if 0
{ 0x00AD, 0x00AD} /* Cf */,
#endif
/*
- * Copyright (C) 2005-2007 Mark Nudelman
+ * Copyright (C) 2005-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
#define A_REMOVE_FILE 52
#define A_NEXT_TAG 53
#define A_PREV_TAG 54
+#define A_FILTER 55
#define A_INVALID 100
#define A_NOACTION 101
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
void *mlist;
int cmdflags;
{
+#if CMD_HISTORY
curr_mlist = (struct mlist *) mlist;
curr_cmdflags = cmdflags;
/* Make sure the next up-arrow moves to the last string in the mlist. */
if (curr_mlist != NULL)
curr_mlist->curr_mp = curr_mlist;
+#endif
}
#if CMD_HISTORY
return (cmdbuf);
}
+#if CMD_HISTORY
/*
* Return the last (most recent) string in the current command history.
*/
return (NULL);
return (curr_mlist->curr_mp->prev->string);
}
+#endif
#if CMD_HISTORY
/*
if (f == NULL)
return;
#if HAVE_FCHMOD
+{
/* Make history file readable only by owner. */
- fchmod(fileno(f), 0600);
+ int do_chmod = 1;
+#if HAVE_STAT
+ struct stat statbuf;
+ int r = fstat(fileno(f), &statbuf);
+ if (r < 0 || !S_ISREG(statbuf.st_mode))
+ /* Don't chmod if not a regular file. */
+ do_chmod = 0;
+#endif
+ if (do_chmod)
+ fchmod(fileno(f), 0600);
+}
#endif
fprintf(f, "%s\n", HISTFILE_FIRST_LINE);
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
extern int sigs;
extern int quit_if_one_screen;
extern int squished;
-extern int hit_eof;
extern int sc_width;
extern int sc_height;
extern int swindow;
static void
cmd_exec()
{
+#if HILITE_SEARCH
clear_attn();
+#endif
clear_bot();
flush();
}
static void
mca_search()
{
+#if HILITE_SEARCH
+ if (search_type & SRCH_FILTER)
+ mca = A_FILTER;
+ else
+#endif
if (search_type & SRCH_FORW)
mca = A_F_SEARCH;
else
if (search_type & SRCH_NO_REGEX)
cmd_putstr("Regex-off ");
+#if HILITE_SEARCH
+ if (search_type & SRCH_FILTER)
+ cmd_putstr("&/");
+ else
+#endif
if (search_type & SRCH_FORW)
cmd_putstr("/");
else
case A_B_SEARCH:
multi_search(cbuf, (int) number);
break;
+#if HILITE_SEARCH
+ case A_FILTER:
+ search_type ^= SRCH_NO_MATCH;
+ set_filter_pattern(cbuf, search_type);
+ break;
+#endif
case A_FIRSTCMD:
/*
* Skip leading spaces or + signs in the string.
case A_F_SEARCH:
case A_B_SEARCH:
+ case A_FILTER:
/*
* Special case for search commands.
* Certain characters as the first char of
{
case CONTROL('E'): /* ignore END of file */
case '*':
- flag = SRCH_PAST_EOF;
+ if (mca != A_FILTER)
+ flag = SRCH_PAST_EOF;
break;
case CONTROL('F'): /* FIRST file */
case '@':
- flag = SRCH_FIRST_FILE;
+ if (mca != A_FILTER)
+ flag = SRCH_FIRST_FILE;
break;
case CONTROL('K'): /* KEEP position */
- flag = SRCH_NO_MOVE;
+ if (mca != A_FILTER)
+ flag = SRCH_NO_MOVE;
break;
case CONTROL('R'): /* Don't use REGULAR EXPRESSIONS */
flag = SRCH_NO_REGEX;
bottompos = position(BOTTOM_PLUS_ONE);
/*
- * If we've hit EOF on the last file, and the -E flag is set
- * (or -F is set and this is the first prompt), then quit.
- * {{ Relying on "first prompt" to detect a single-screen file
- * fails if +G is used, for example. }}
+ * If we've hit EOF on the last file and the -E flag is set, quit.
*/
- if ((get_quit_at_eof() == OPT_ONPLUS || quit_if_one_screen) &&
- hit_eof && !(ch_getflags() & CH_HELPFILE) &&
+ if (get_quit_at_eof() == OPT_ONPLUS &&
+ eof_displayed() && !(ch_getflags() & CH_HELPFILE) &&
next_ifile(curr_ifile) == NULL_IFILE)
quit(QUIT_OK);
- quit_if_one_screen = FALSE;
-#if 0 /* This doesn't work well because some "te"s clear the screen. */
+
/*
- * If the -e flag is set and we've hit EOF on the last file,
- * and the file is squished (shorter than the screen), quit.
+ * If the entire file is displayed and the -F flag is set, quit.
*/
- if (get_quit_at_eof() && squished &&
+ if (quit_if_one_screen &&
+ entire_file_displayed() && !(ch_getflags() & CH_HELPFILE) &&
next_ifile(curr_ifile) == NULL_IFILE)
quit(QUIT_OK);
-#endif
#if MSDOS_COMPILER==WIN32C
/*
clear_cmd();
forw_prompt = 0;
p = pr_string();
+ if (is_filtering())
+ putstr("& ");
if (p == NULL || *p == '\0')
putchr(':');
else
cmd_exec();
jump_forw();
ignore_eoi = 1;
- hit_eof = 0;
while (!sigs)
{
make_display();
c = getcc();
goto again;
+ case A_FILTER:
+#if HILITE_SEARCH
+ search_type = SRCH_FORW | SRCH_FILTER;
+ mca_search();
+ c = getcc();
+ goto again;
+#else
+ error("Command not available", NULL_PARG);
+ break;
+#endif
+
case A_AGAIN_SEARCH:
/*
* Repeat previous search.
number = 1;
if (edit_next((int) number))
{
- if (get_quit_at_eof() && hit_eof &&
+ if (get_quit_at_eof() && eof_displayed() &&
!(ch_getflags() & CH_HELPFILE))
quit(QUIT_OK);
parg.p_string = (number > 1) ? "(N-th) " : "";
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
ESC,'n',0, A_T_AGAIN_SEARCH,
'N',0, A_REVERSE_SEARCH,
ESC,'N',0, A_T_REVERSE_SEARCH,
+ '&',0, A_FILTER,
'm',0, A_SETMARK,
'\'',0, A_GOMARK,
CONTROL('X'),CONTROL('X'),0, A_GOMARK,
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
bin_file(f)
int f;
{
- int i;
int n;
int bin_count = 0;
- unsigned char data[256];
+ char data[256];
+ char* p;
+ char* pend;
if (!seekable(f))
return (0);
if (lseek(f, (off_t)0, SEEK_SET) == BAD_LSEEK)
return (0);
n = read(f, data, sizeof(data));
- for (i = 0; i < n; i++)
+ pend = &data[n];
+ for (p = data; p < pend; )
{
- char c = data[i];
+ LWCHAR c = step_char(&p, +1, pend);
if (ctldisp == OPT_ONPLUS && IS_CSI_START(c))
{
- while (++i < n && is_ansi_middle(data[i]))
- continue;
+ do {
+ c = step_char(&p, +1, pend);
+ } while (p < pend && is_ansi_middle(c));
} else if (binary_char(c))
bin_count++;
}
ch_ungetchar(-1);
if ((lessopen = lgetenv("LESSOPEN")) == NULL)
return (NULL);
- if (strcmp(filename, "-") == 0)
- return (NULL);
if (*lessopen == '|')
{
/*
* If LESSOPEN starts with a |, it indicates
* a "pipe preprocessor".
*/
-#if HAVE_FILENO
- lessopen++;
- returnfd = 1;
-#else
+#if !HAVE_FILENO
error("LESSOPEN pipe is not supported", NULL_PARG);
return (NULL);
+#else
+ lessopen++;
+ returnfd = 1;
+ if (*lessopen == '-') {
+ /*
+ * Lessopen preprocessor will accept "-" as a filename.
+ */
+ lessopen++;
+ } else {
+ if (strcmp(filename, "-") == 0)
+ return (NULL);
+ }
#endif
}
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
#include "less.h"
#include "position.h"
-public int hit_eof; /* Keeps track of how many times we hit end of file */
public int screen_trashed;
public int squished;
public int no_back_scroll = 0;
}
/*
- * Check to see if the end of file is currently "displayed".
+ * Check to see if the end of file is currently displayed.
*/
- static void
-eof_check()
+ public int
+eof_displayed()
{
POSITION pos;
if (ignore_eoi)
- return;
- if (ABORT_SIGS())
- return;
+ return (0);
+
+ if (ch_length() == NULL_POSITION)
+ /*
+ * If the file length is not known,
+ * we can't possibly be displaying EOF.
+ */
+ return (0);
+
/*
* If the bottom line is empty, we are at EOF.
* If the bottom line ends at the file length,
* we must be just at EOF.
*/
pos = position(BOTTOM_PLUS_ONE);
- if (pos == NULL_POSITION || pos == ch_length())
- hit_eof++;
+ return (pos == NULL_POSITION || pos == ch_length());
+}
+
+/*
+ * Check to see if the entire file is currently displayed.
+ */
+ public int
+entire_file_displayed()
+{
+ POSITION pos;
+
+ /* Make sure last line of file is displayed. */
+ if (!eof_displayed())
+ return (0);
+
+ /* Make sure first line of file is displayed. */
+ pos = position(0);
+ return (pos == NULL_POSITION || pos == 0);
}
/*
forw_prompt = 1;
}
- if (ignore_eoi)
- hit_eof = 0;
- else if (eof && !ABORT_SIGS())
- hit_eof++;
- else
- eof_check();
if (nlines == 0)
eof_bell();
else if (do_repaint)
squish_check();
do_repaint = (n > get_back_scroll() || (only_last && n > sc_height-1));
- hit_eof = 0;
while (--n >= 0)
{
/*
}
}
- eof_check();
if (nlines == 0)
eof_bell();
else if (do_repaint)
{
POSITION pos;
- if (get_quit_at_eof() && hit_eof && !(ch_getflags() & CH_HELPFILE))
+ if (get_quit_at_eof() && eof_displayed() && !(ch_getflags() & CH_HELPFILE))
{
/*
* If the -e flag is set and we're trying to go
} else
{
eof_bell();
- hit_eof++;
return;
}
}
public char * bad_file ();
public POSITION filesize ();
public char * shell_coption ();
+ public int eof_displayed ();
+ public int entire_file_displayed ();
public void squish_check ();
public void forw ();
public void back ();
public int pappend ();
public int pflushmbc ();
public void pdone ();
+ public void set_status_col ();
public int gline ();
public void null_line ();
public POSITION forw_raw_line ();
public void repaint_hilite ();
public void clear_attn ();
public void undo_search ();
+ public void clr_hlist ();
public void clr_hilite ();
+ public void clr_filter ();
+ public int is_filtered ();
public int is_hilited ();
public void chg_caseless ();
public void chg_hilite ();
public int search ();
public void prep_hilite ();
+ public void set_filter_pattern ();
+ public int is_filtering ();
public RETSIGTYPE winch ();
public RETSIGTYPE winch ();
public void init_signals ();
' ',' ','E','S','C','-','n',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','R','e','p','e','a','t',' ','p','r','e','v','i','o','u','s',' ','s','e','a','r','c','h',',',' ','s','p','a','n','n','i','n','g',' ','f','i','l','e','s','.','\n',
' ',' ','E','S','C','-','N',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','R','e','p','e','a','t',' ','p','r','e','v','i','o','u','s',' ','s','e','a','r','c','h',',',' ','r','e','v','e','r','s','e',' ','d','i','r','.',' ','&',' ','s','p','a','n','n','i','n','g',' ','f','i','l','e','s','.','\n',
' ',' ','E','S','C','-','u',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','U','n','d','o',' ','(','t','o','g','g','l','e',')',' ','s','e','a','r','c','h',' ','h','i','g','h','l','i','g','h','t','i','n','g','.','\n',
+' ',' ','&','_','\b','p','_','\b','a','_','\b','t','_','\b','t','_','\b','e','_','\b','r','_','\b','n',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','D','i','s','p','l','a','y',' ','o','n','l','y',' ','m','a','t','c','h','i','n','g',' ','l','i','n','e','s','\n',
' ',' ',' ',' ',' ',' ',' ',' ','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\n',
' ',' ',' ',' ',' ',' ',' ',' ','S','e','a','r','c','h',' ','p','a','t','t','e','r','n','s',' ','m','a','y',' ','b','e',' ','m','o','d','i','f','i','e','d',' ','b','y',' ','o','n','e',' ','o','r',' ','m','o','r','e',' ','o','f',':','\n',
' ',' ',' ',' ',' ',' ',' ',' ','^','N',' ','o','r',' ','!',' ',' ','S','e','a','r','c','h',' ','f','o','r',' ','N','O','N','-','m','a','t','c','h','i','n','g',' ','l','i','n','e','s','.','\n',
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
int endline;
int backchars;
+get_forw_line:
if (curr_pos == NULL_POSITION)
{
null_line();
return (NULL_POSITION);
}
#if HILITE_SEARCH
- if (hilite_search == OPT_ONPLUS || status_col)
+ if (hilite_search == OPT_ONPLUS || is_filtering() || status_col)
/*
* If we are ignoring EOI (command F), only prepare
* one line ahead, to avoid getting stuck waiting for
return (NULL_POSITION);
}
+ /*
+ * Step back to the beginning of the line.
+ */
base_pos = curr_pos;
for (;;)
{
--base_pos;
}
+ /*
+ * Read forward again to the position we should start at.
+ */
prewind();
plinenum(base_pos);
(void) ch_seek(base_pos);
- while (base_pos < curr_pos)
+ new_pos = base_pos;
+ while (new_pos < curr_pos)
{
if (ABORT_SIGS())
{
return (NULL_POSITION);
}
c = ch_forw_get();
- backchars = pappend(c, base_pos);
- base_pos++;
+ backchars = pappend(c, new_pos);
+ new_pos++;
if (backchars > 0)
{
pshift_all();
- base_pos -= backchars;
+ new_pos -= backchars;
while (--backchars >= 0)
(void) ch_back_get();
}
(void) pflushmbc();
pshift_all();
+ /*
+ * Read the first character to display.
+ */
c = ch_forw_get();
if (c == EOI)
{
}
blankline = (c == '\n' || c == '\r');
+ /*
+ * Read each character in the line and append to the line buffer.
+ */
for (;;)
{
if (ABORT_SIGS())
}
c = ch_forw_get();
}
- pdone(endline);
+
+ pdone(endline, c);
+
+#if HILITE_SEARCH
+ if (is_filtered(base_pos))
+ {
+ /*
+ * We don't want to display this line.
+ * Get the next line.
+ */
+ curr_pos = new_pos;
+ goto get_forw_line;
+ }
+
+ if (status_col && is_hilited(base_pos, ch_tell()-1, 1, NULL))
+ set_status_col('*');
+#endif
if (squeeze && blankline)
{
back_line(curr_pos)
POSITION curr_pos;
{
- POSITION new_pos, begin_new_pos;
+ POSITION new_pos, begin_new_pos, base_pos;
int c;
int endline;
int backchars;
+get_back_line:
if (curr_pos == NULL_POSITION || curr_pos <= ch_zero())
{
null_line();
return (NULL_POSITION);
}
#if HILITE_SEARCH
- if (hilite_search == OPT_ONPLUS || status_col)
+ if (hilite_search == OPT_ONPLUS || is_filtering() || status_col)
prep_hilite((curr_pos < 3*size_linebuf) ?
0 : curr_pos - 3*size_linebuf, curr_pos, -1);
#endif
/*
* Find out if the "current" line was blank.
*/
- (void) ch_forw_get(); /* Skip the newline */
- c = ch_forw_get(); /* First char of "current" line */
- (void) ch_back_get(); /* Restore our position */
+ (void) ch_forw_get(); /* Skip the newline */
+ c = ch_forw_get(); /* First char of "current" line */
+ (void) ch_back_get(); /* Restore our position */
(void) ch_back_get();
if (c == '\n' || c == '\r')
* This is the newline ending the previous line.
* We have hit the beginning of the line.
*/
- new_pos = ch_tell() + 1;
+ base_pos = ch_tell() + 1;
break;
}
if (c == EOI)
* This must be the first line in the file.
* This must, of course, be the beginning of the line.
*/
- new_pos = ch_tell();
+ base_pos = ch_tell();
break;
}
}
* are much longer than the screen width,
* but I don't know of any better way. }}
*/
+ new_pos = base_pos;
if (ch_seek(new_pos))
{
null_line();
}
} while (new_pos < curr_pos);
- pdone(endline);
+ pdone(endline, ch_forw_get());
+
+#if HILITE_SEARCH
+ if (is_filtered(base_pos))
+ {
+ /*
+ * We don't want to display this line.
+ * Get the previous line.
+ */
+ curr_pos = begin_new_pos;
+ goto get_back_line;
+ }
+
+ if (status_col && is_hilited(base_pos, ch_tell()-1, 1, NULL))
+ set_status_col('*');
+#endif
return (begin_new_pos);
}
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
#include "less.h"
#include "position.h"
-extern int hit_eof;
extern int jump_sline;
extern int squished;
extern int screen_trashed;
error("Cannot seek to end of file", NULL_PARG);
return;
}
+ /*
+ * Note; lastmark will be called later by jump_loc, but it fails
+ * because the position table has been cleared by pos_clear below.
+ * So call it here before calling pos_clear.
+ */
+ lastmark();
/*
* Position the last line in the file at the last screen line.
* Go back one line from the end of the file
forw(nline, position(BOTTOM_PLUS_ONE), 1, 0, 0);
else
back(-nline, position(TOP), 1, 0);
+#if HILITE_SEARCH
if (show_attn)
repaint_hilite(1);
+#endif
return;
}
* that we can just scroll there after all.
*/
forw(sc_height-sline+nline-1, bpos, 1, 0, 0);
+#if HILITE_SEARCH
if (show_attn)
repaint_hilite(1);
+#endif
return;
}
pos = back_line(pos);
}
}
lastmark();
- hit_eof = 0;
squished = 0;
screen_trashed = 0;
forw(sc_height-1, pos, 1, 0, sline-nline);
* that we can just scroll there after all.
*/
back(nline+1, tpos, 1, 0);
+#if HILITE_SEARCH
if (show_attn)
repaint_hilite(1);
+#endif
return;
}
}
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
#define IS_DIGIT(c) ((c) >= '0' && (c) <= '9')
#endif
-#define IS_CSI_START(c) ((c) == ESC || (!utf_mode && ((unsigned char)(c)) == CSI))
+#define IS_CSI_START(c) (((LWCHAR)(c)) == ESC || (((LWCHAR)(c)) == CSI))
#ifndef NULL
#define NULL 0
#define BS_CONTROL 2 /* \b treated as control char; prints as ^H */
/* How should we search? */
-#define SRCH_FORW (1 << 0) /* Search forward from current position */
-#define SRCH_BACK (1 << 1) /* Search backward from current position */
-#define SRCH_NO_MOVE (1 << 2) /* Highlight, but don't move */
-#define SRCH_FIND_ALL (1 << 4) /* Find and highlight all matches */
-#define SRCH_NO_MATCH (1 << 8) /* Search for non-matching lines */
-#define SRCH_PAST_EOF (1 << 9) /* Search past end-of-file, into next file */
-#define SRCH_FIRST_FILE (1 << 10) /* Search starting at the first file */
-#define SRCH_NO_REGEX (1 << 12) /* Don't use regular expressions */
+#define SRCH_FORW (1 << 0) /* Search forward from current position */
+#define SRCH_BACK (1 << 1) /* Search backward from current position */
+#define SRCH_NO_MOVE (1 << 2) /* Highlight, but don't move */
+#define SRCH_FIND_ALL (1 << 4) /* Find and highlight all matches */
+#define SRCH_NO_MATCH (1 << 8) /* Search for non-matching lines */
+#define SRCH_PAST_EOF (1 << 9) /* Search past end-of-file, into next file */
+#define SRCH_FIRST_FILE (1 << 10) /* Search starting at the first file */
+#define SRCH_NO_REGEX (1 << 12) /* Don't use regular expressions */
+#define SRCH_FILTER (1 << 13) /* Search is for '&' (filter) command */
#define SRCH_REVERSE(t) (((t) & SRCH_FORW) ? \
(((t) & ~SRCH_FORW) | SRCH_BACK) : \
-.TH LESS 1 "Version 418: 02 Jan 2008"
+.TH LESS 1 "Version 429: 11 Apr 2009"
.SH NAME
less \- opposite of more
.SH SYNOPSIS
Any search command will also turn highlighting back on.
(Highlighting can also be disabled by toggling the \-G option;
in that case search commands do not turn highlighting back on.)
+.IP "&pattern"
+Display only lines which match the pattern;
+lines which do not match the pattern are not displayed.
+If pattern is empty (if you type & immediately followed by ENTER),
+any filtering is turned off, and all lines are displayed.
+While filtering is in effect, an ampersand is displayed at the
+beginning of the prompt,
+as a reminder that some lines in the file may be hidden.
+.sp
+Certain characters are special as in the / command:
+.RS
+.IP "^N or !"
+Display only lines which do NOT match the pattern.
+.IP "^R"
+Don't interpret regular expression metacharacters;
+that is, do a simple textual comparison.
+.RE
.IP ":e [filename]"
Examine a new file.
If the filename is missing, the "current" file (see the :n and :p commands
\fIcolor\fP is a pair of numbers separated by a period.
The first number selects the foreground color and the second selects
the background color of the text.
-A single number \fIN\fP is the same as \fIN.0\fP.
+A single number \fIN\fP is the same as \fIN.M\fP,
+where \fIM\fP is the normal background color.
+
.IP "\-e or \-\-quit-at-eof"
Causes
.I less
to clean up.
In this case, the replacement file name passed to the LESSCLOSE
postprocessor is "\-".
+.PP
+For compatibility with previous versions of
+.I less,
+the input pipe is not used if
+.I less
+is viewing standard input.
+However, if the character after the vertical bar is a dash (\-),
+the input pipe is used on standard input as well as other files.
.SH "NATIONAL CHARACTER SETS"
There are three types of characters in the input file:
lesskey(1)
.SH COPYRIGHT
-Copyright (C) 1984-2007 Mark Nudelman
+Copyright (C) 1984-2008 Mark Nudelman
.PP
less is part of the GNU project and is free software.
You can redistribute it and/or modify it
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
#include "less.h"
-static char *version = "$Revision: 1.11 $";
+static char *version = "$Revision: 1.12 $";
static int quote_all = 0;
static char openquote = '"';
-.TH LESSECHO 1 "Version 418: 02 Jan 2008"
+.TH LESSECHO 1 "Version 429: 11 Apr 2009"
.SH NAME
lessecho \- expand metacharacters
.SH SYNOPSIS
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
struct cmdname cmdnames[] =
{
- { "back-bracket", A_B_BRACKET },
- { "back-line", A_B_LINE },
- { "back-line-force", A_BF_LINE },
- { "back-screen", A_B_SCREEN },
- { "back-scroll", A_B_SCROLL },
- { "back-search", A_B_SEARCH },
- { "back-window", A_B_WINDOW },
- { "debug", A_DEBUG },
- { "digit", A_DIGIT },
- { "display-flag", A_DISP_OPTION },
- { "display-option", A_DISP_OPTION },
- { "end", A_GOEND },
- { "examine", A_EXAMINE },
- { "first-cmd", A_FIRSTCMD },
- { "firstcmd", A_FIRSTCMD },
- { "flush-repaint", A_FREPAINT },
- { "forw-bracket", A_F_BRACKET },
- { "forw-forever", A_F_FOREVER },
- { "forw-line", A_F_LINE },
- { "forw-line-force", A_FF_LINE },
- { "forw-screen", A_F_SCREEN },
- { "forw-screen-force", A_FF_SCREEN },
- { "forw-scroll", A_F_SCROLL },
- { "forw-search", A_F_SEARCH },
- { "forw-window", A_F_WINDOW },
- { "goto-end", A_GOEND },
- { "goto-line", A_GOLINE },
- { "goto-mark", A_GOMARK },
- { "help", A_HELP },
- { "index-file", A_INDEX_FILE },
- { "invalid", A_UINVALID },
- { "left-scroll", A_LSHIFT },
- { "next-file", A_NEXT_FILE },
- { "next-tag", A_NEXT_TAG },
- { "noaction", A_NOACTION },
- { "percent", A_PERCENT },
- { "pipe", A_PIPE },
- { "prev-file", A_PREV_FILE },
- { "prev-tag", A_PREV_TAG },
- { "quit", A_QUIT },
- { "remove-file", A_REMOVE_FILE },
- { "repaint", A_REPAINT },
- { "repaint-flush", A_FREPAINT },
- { "repeat-search", A_AGAIN_SEARCH },
- { "repeat-search-all", A_T_AGAIN_SEARCH },
- { "reverse-search", A_REVERSE_SEARCH },
- { "reverse-search-all", A_T_REVERSE_SEARCH },
- { "right-scroll", A_RSHIFT },
- { "set-mark", A_SETMARK },
- { "shell", A_SHELL },
- { "status", A_STAT },
- { "toggle-flag", A_OPT_TOGGLE },
- { "toggle-option", A_OPT_TOGGLE },
- { "undo-hilite", A_UNDO_SEARCH },
- { "version", A_VERSION },
- { "visual", A_VISUAL },
- { NULL, 0 }
+ { "back-bracket", A_B_BRACKET },
+ { "back-line", A_B_LINE },
+ { "back-line-force", A_BF_LINE },
+ { "back-screen", A_B_SCREEN },
+ { "back-scroll", A_B_SCROLL },
+ { "back-search", A_B_SEARCH },
+ { "back-window", A_B_WINDOW },
+ { "debug", A_DEBUG },
+ { "digit", A_DIGIT },
+ { "display-flag", A_DISP_OPTION },
+ { "display-option", A_DISP_OPTION },
+ { "end", A_GOEND },
+ { "examine", A_EXAMINE },
+ { "filter", A_FILTER },
+ { "first-cmd", A_FIRSTCMD },
+ { "firstcmd", A_FIRSTCMD },
+ { "flush-repaint", A_FREPAINT },
+ { "forw-bracket", A_F_BRACKET },
+ { "forw-forever", A_F_FOREVER },
+ { "forw-line", A_F_LINE },
+ { "forw-line-force", A_FF_LINE },
+ { "forw-screen", A_F_SCREEN },
+ { "forw-screen-force", A_FF_SCREEN },
+ { "forw-scroll", A_F_SCROLL },
+ { "forw-search", A_F_SEARCH },
+ { "forw-window", A_F_WINDOW },
+ { "goto-end", A_GOEND },
+ { "goto-line", A_GOLINE },
+ { "goto-mark", A_GOMARK },
+ { "help", A_HELP },
+ { "index-file", A_INDEX_FILE },
+ { "invalid", A_UINVALID },
+ { "left-scroll", A_LSHIFT },
+ { "next-file", A_NEXT_FILE },
+ { "next-tag", A_NEXT_TAG },
+ { "noaction", A_NOACTION },
+ { "percent", A_PERCENT },
+ { "pipe", A_PIPE },
+ { "prev-file", A_PREV_FILE },
+ { "prev-tag", A_PREV_TAG },
+ { "quit", A_QUIT },
+ { "remove-file", A_REMOVE_FILE },
+ { "repaint", A_REPAINT },
+ { "repaint-flush", A_FREPAINT },
+ { "repeat-search", A_AGAIN_SEARCH },
+ { "repeat-search-all", A_T_AGAIN_SEARCH },
+ { "reverse-search", A_REVERSE_SEARCH },
+ { "reverse-search-all", A_T_REVERSE_SEARCH },
+ { "right-scroll", A_RSHIFT },
+ { "set-mark", A_SETMARK },
+ { "shell", A_SHELL },
+ { "status", A_STAT },
+ { "toggle-flag", A_OPT_TOGGLE },
+ { "toggle-option", A_OPT_TOGGLE },
+ { "undo-hilite", A_UNDO_SEARCH },
+ { "version", A_VERSION },
+ { "visual", A_VISUAL },
+ { NULL, 0 }
};
struct cmdname editnames[] =
control_line(s)
char *s;
{
-#define PREFIX(str,pat) (strncmp(str,pat,strlen(pat)-1) == 0)
+#define PREFIX(str,pat) (strncmp(str,pat,strlen(pat)) == 0)
if (PREFIX(s, "#line-edit"))
{
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
-.TH LESSKEY 1 "Version 418: 02 Jan 2008"
+.TH LESSKEY 1 "Version 429: 11 Apr 2009"
.SH NAME
lesskey \- specify key bindings for less
.SH SYNOPSIS
\een repeat-search-all
N reverse-search
\eeN reverse-search-all
+ & filter
m set-mark
' goto-mark
^X^X goto-mark
This NUL character should be represented as \e340 in a lesskey file.
.SH COPYRIGHT
-Copyright (C) 2000-2007 Mark Nudelman
+Copyright (C) 2000-2008 Mark Nudelman
.PP
lesskey is part of the GNU project and is free software;
you can redistribute it and/or modify it
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
static int last_overstrike = AT_NORMAL;
static int is_null_line; /* There is no current line */
static int lmargin; /* Left margin */
-static int line_matches; /* Number of search matches in this line */
static char pendc;
static POSITION pendpos;
static char *end_ansi_chars;
extern int so_s_width, so_e_width;
extern int sc_width, sc_height;
extern int utf_mode;
-extern int oldbot;
extern POSITION start_attnpos;
extern POSITION end_attnpos;
lmargin = 0;
if (status_col)
lmargin += 1;
-#if HILITE_SEARCH
- line_matches = 0;
-#endif
}
/*
if (a != AT_ANSI)
a |= AT_HILITE;
}
- line_matches += matches;
}
#endif
{
if (!is_ansi_end(ch) && !is_ansi_middle(ch)) {
/* Remove whole unrecognized sequence. */
+ char *p = &linebuf[curr];
+ LWCHAR bch;
do {
- if (curr == 0)
- break;
- --curr;
- } while (!IS_CSI_START(linebuf[curr]));
+ bch = step_char(&p, -1, linebuf);
+ } while (p > linebuf && !IS_CSI_START(bch));
+ curr = p - linebuf;
return 0;
}
a = AT_ANSI; /* Will force re-AT_'ing around it. */
* Terminate the line in the line buffer.
*/
public void
-pdone(endline)
+pdone(endline, nextc)
int endline;
+ int nextc;
{
int nl;
* the next line is blank. In that case the single newline output for
* that blank line would be ignored!)
*/
- if (!oldbot)
- nl = (column < sc_width || !auto_wrap || (endline && ignaw) || ctldisp == OPT_ON);
- else
- nl = (column < sc_width || !auto_wrap || ignaw || ctldisp == OPT_ON);
- if (nl)
+ if (column < sc_width || !auto_wrap || (endline && ignaw) || ctldisp == OPT_ON)
{
linebuf[curr] = '\n';
attr[curr] = AT_NORMAL;
curr++;
}
- else if (ignaw && !auto_wrap && column >= sc_width)
+ else if (ignaw && column >= sc_width)
{
/*
- * Big horrible kludge.
- * No-wrap terminals are too hard to deal with when they get in
- * the state where a full screen width of characters have been
- * output but the cursor is sitting on the right edge instead
- * of at the start of the next line.
- * So after we output a full line, we output an extra
- * space and backspace to force the cursor to the
- * beginning of the next line, like a sane terminal.
+ * Terminals with "ignaw" don't wrap until they *really* need
+ * to, i.e. when the character *after* the last one to fit on a
+ * line is output. But they are too hard to deal with when they
+ * get in the state where a full screen width of characters
+ * have been output but the cursor is sitting on the right edge
+ * instead of at the start of the next line.
+ * So we nudge them into wrapping by outputting the next
+ * character plus a backspace. (This wouldn't be right for
+ * "!auto_wrap" terminals, but they always end up in the
+ * branch above.)
*/
- linebuf[curr] = ' ';
+ linebuf[curr] = nextc;
attr[curr++] = AT_NORMAL;
linebuf[curr] = '\b';
attr[curr++] = AT_NORMAL;
}
linebuf[curr] = '\0';
attr[curr] = AT_NORMAL;
+}
-#if HILITE_SEARCH
- if (status_col && line_matches > 0)
- {
- linebuf[0] = '*';
- attr[0] = AT_NORMAL|AT_HILITE;
- }
-#endif
+/*
+ *
+ */
+ public void
+set_status_col(c)
+ char c;
+{
+ linebuf[0] = c;
+ attr[0] = AT_NORMAL|AT_HILITE;
}
/*
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
* when we have a new one to insert and the table is full.
*/
-#define NPOOL 50 /* Size of line number pool */
+#define NPOOL 200 /* Size of line number pool */
#define LONGTIME (2) /* In seconds */
-public int lnloop = 0; /* Are we in the line num loop? */
-
static struct linenum_info anchor; /* Anchor of the list */
static struct linenum_info *freelist; /* Anchor of the unused entries */
static struct linenum_info pool[NPOOL]; /* The pool itself */
extern int linenums;
extern int sigs;
extern int sc_height;
+extern int screen_trashed;
/*
* Initialize the line number structures.
longloopmessage()
{
ierror("Calculating line numbers", NULL_PARG);
- /*
- * Set the lnloop flag here, so if the user interrupts while
- * we are calculating line numbers, the signal handler will
- * turn off line numbers (linenums=0).
- */
- lnloop = 1;
}
static int loopcount;
}
/*
+ * Turn off line numbers because the user has interrupted
+ * a lengthy line number calculation.
+ */
+ static void
+abort_long()
+{
+ if (linenums == OPT_ONPLUS)
+ /*
+ * We were displaying line numbers, so need to repaint.
+ */
+ screen_trashed = 1;
+ linenums = 0;
+ error("Line numbers turned off", NULL_PARG);
+}
+
+/*
* Find the line number associated with a given position.
* Return 0 if we can't figure it out.
*/
* Allow a signal to abort this loop.
*/
cpos = forw_raw_line(cpos, (char **)NULL, (int *)NULL);
- if (ABORT_SIGS() || cpos == NULL_POSITION)
+ if (ABORT_SIGS()) {
+ abort_long();
+ return (0);
+ }
+ if (cpos == NULL_POSITION)
return (0);
longish();
}
- lnloop = 0;
/*
* We might as well cache it.
*/
* Allow a signal to abort this loop.
*/
cpos = back_raw_line(cpos, (char **)NULL, (int *)NULL);
- if (ABORT_SIGS() || cpos == NULL_POSITION)
+ if (ABORT_SIGS()) {
+ abort_long();
+ return (0);
+ }
+ if (cpos == NULL_POSITION)
return (0);
longish();
}
- lnloop = 0;
/*
* We might as well cache it.
*/
* Allow a signal to abort this loop.
*/
cpos = forw_raw_line(cpos, (char **)NULL, (int *)NULL);
- if (ABORT_SIGS() || cpos == NULL_POSITION)
+ if (ABORT_SIGS())
+ return (NULL_POSITION);
+ if (cpos == NULL_POSITION)
return (NULL_POSITION);
}
} else
* Allow a signal to abort this loop.
*/
cpos = back_raw_line(cpos, (char **)NULL, (int *)NULL);
- if (ABORT_SIGS() || cpos == NULL_POSITION)
+ if (ABORT_SIGS())
+ return (NULL_POSITION);
+ if (cpos == NULL_POSITION)
return (NULL_POSITION);
}
}
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
register char *p;
#endif
IFILE save_ifile;
-#if MSDOS_COMPILER
+#if MSDOS_COMPILER && MSDOS_COMPILER!=WIN32C
char cwd[FILENAME_MAX+1];
#endif
}
#if MSDOS_COMPILER
+#if MSDOS_COMPILER==WIN32C
+ if (*cmd == '\0')
+ cmd = getenv("COMSPEC");
+#else
/*
* Working directory is global on MSDOS.
* The child might change the working directory, so we
*/
getcwd(cwd, FILENAME_MAX);
#endif
+#endif
/*
* Close the current input file.
init();
screen_trashed = 1;
-#if MSDOS_COMPILER
+#if MSDOS_COMPILER && MSDOS_COMPILER!=WIN32C
/*
* Restore the previous directory (possibly
* changed by the child program we just ran).
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
any_display = 1;
putstr("less ");
putstr(version);
- putstr("\nCopyright (C) 1984-2007 Mark Nudelman\n\n");
+ putstr("\nCopyright (C) 1984-2008 Mark Nudelman\n\n");
putstr("less comes with NO WARRANTY, to the extent permitted by law.\n");
putstr("For information about the terms of redistribution,\n");
putstr("see the file named README in the less distribution.\n");
return;
}
if (*s != '.')
- bg = 0;
+ bg = nm_bg_color;
else
{
s++;
bg = getnum(&s, "D", &err);
if (err)
{
- error("Missing fg color in -D", NULL_PARG);
+ error("Missing bg color in -D", NULL_PARG);
return;
}
}
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
*/
char *anchor, *p, *p_next;
unsigned char fg, bg;
+ static unsigned char at;
#if MSDOS_COMPILER==WIN32C
/* Screen colors used by 3x and 4x SGR commands. */
static unsigned char screen_color[] = {
switch (code)
{
default:
- /* case 0: all attrs off */
- /* case 22: bold off */
- /* case 23: italic off */
- /* case 24: underline off */
- /* case 27: inverse off */
+ /* case 0: all attrs off */
fg = nm_fg_color;
bg = nm_bg_color;
+ at = 0;
break;
case 1: /* bold on */
- fg = bo_fg_color;
- bg = bo_bg_color;
+ at |= 1;
break;
case 3: /* italic on */
case 7: /* inverse on */
- fg = so_fg_color;
- bg = so_bg_color;
+ at |= 2;
break;
case 4: /* underline on */
- fg = ul_fg_color;
- bg = ul_bg_color;
+ at |= 4;
break;
case 5: /* slow blink on */
case 6: /* fast blink on */
- fg = bl_fg_color;
- bg = bl_bg_color;
+ at |= 8;
break;
case 8: /* concealed on */
fg = (bg & 7) | 8;
break;
+ case 22: /* bold off */
+ at &= ~1;
+ break;
+ case 23: /* italic off */
+ case 27: /* inverse off */
+ at &= ~2;
+ break;
+ case 24: /* underline off */
+ at &= ~4;
+ break;
case 30: case 31: case 32:
case 33: case 34: case 35:
case 36: case 37:
}
if (!is_ansi_end(*p) || p == p_next)
break;
+ if (at & 1)
+ {
+ fg = bo_fg_color;
+ bg = bo_bg_color;
+ } else if (at & 2)
+ {
+ fg = so_fg_color;
+ bg = so_bg_color;
+ } else if (at & 4)
+ {
+ fg = ul_fg_color;
+ bg = ul_bg_color;
+ } else if (at & 8)
+ {
+ fg = bl_fg_color;
+ bg = bl_bg_color;
+ }
fg &= 0xf;
bg &= 0xf;
WIN32setcolors(fg, bg);
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
#include "position.h"
extern int pr_type;
-extern int hit_eof;
extern int new_file;
extern int sc_width;
extern int so_s_width, so_e_width;
case 'c':
return (hshift != 0);
case 'e': /* At end of file? */
- return (hit_eof);
+ return (eof_displayed());
case 'f': /* Filename known? */
return (strcmp(get_filename(curr_ifile), "-") != 0);
case 'l': /* Line number known? */
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
*/
for (i = 1; i < sc_height; i++)
putchr('\n');
- }
+ } else
+ line_left();
#else
#if MSDOS_COMPILER==WIN32C
if (!no_init)
/* Move the source text to the top of the screen. */
new_org.X = rcSrc.Left;
- new_org.Y = 0;
+ /* new_org.Y = rcClip.top; -- doesn't compile under MSVC6 */
/* Fill the right character and attributes. */
fillchar.Char.AsciiChar = ' ';
int len;
{
#if MSDOS_COMPILER==WIN32C
- WriteConsole(con_out, text, len, NULL, NULL);
+ DWORD written;
+ WriteConsole(con_out, text, len, &written, NULL);
#else
char c = text[len];
text[len] = '\0';
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
extern void * constant ml_search;
extern POSITION start_attnpos;
extern POSITION end_attnpos;
+extern int utf_mode;
+extern int screen_trashed;
#if HILITE_SEARCH
extern int hilite_search;
-extern int screen_trashed;
extern int size_linebuf;
extern int squished;
extern int can_goto_line;
-extern int utf_mode;
static int hide_hilite;
static int oldbot;
static POSITION prep_startpos;
POSITION hl_endpos;
};
static struct hilite hilite_anchor = { NULL, NULL_POSITION, NULL_POSITION };
+static struct hilite filter_anchor = { NULL, NULL_POSITION, NULL_POSITION };
#define hl_first hl_next
#endif
* search pattern.
*/
#if HAVE_POSIX_REGCOMP
-static regex_t *regpattern = NULL;
+#define DEFINE_PATTERN(name) static regex_t *name = NULL
#endif
#if HAVE_PCRE
-pcre *regpattern = NULL;
+#define DEFINE_PATTERN(name) pcre *name = NULL;
#endif
#if HAVE_RE_COMP
-int re_pattern = 0;
+#define DEFINE_PATTERN(name) int name = 0;
#endif
#if HAVE_REGCMP
-static char *cpattern = NULL;
+#define DEFINE_PATTERN(name) static char *name = NULL;
#endif
#if HAVE_V8_REGCOMP
-static struct regexp *regpattern = NULL;
+#define DEFINE_PATTERN(name) static struct regexp *name = NULL;
#endif
+DEFINE_PATTERN(search_pattern);
+DEFINE_PATTERN(filter_pattern);
+
static int is_caseless;
static int is_ucase_pattern;
static int last_search_type;
+static int last_filter_type;
static char *last_pattern = NULL;
#define CVT_TO_LC 01 /* Convert upper-case to lower-case */
}
/*
- * Convert text. Perform one or more of these transformations:
+ * Convert text. Perform the transformations specified by ops.
*/
static void
cvt_text(odst, osrc, lenp, ops)
if (last_search_type & SRCH_NO_REGEX)
return (last_pattern != NULL);
#if HAVE_POSIX_REGCOMP
- return (regpattern != NULL);
+ return (search_pattern != NULL);
#endif
#if HAVE_PCRE
- return (regpattern != NULL);
+ return (search_pattern != NULL);
#endif
#if HAVE_RE_COMP
- return (re_pattern != 0);
+ return (search_pattern != 0);
#endif
#if HAVE_REGCMP
- return (cpattern != NULL);
+ return (search_pattern != NULL);
#endif
#if HAVE_V8_REGCOMP
- return (regpattern != NULL);
+ return (search_pattern != NULL);
#endif
#if NO_REGEX
- return (last_pattern != NULL);
+ return (search_pattern != NULL);
#endif
}
* Compile a search pattern, for future use by match_pattern.
*/
static int
-compile_pattern2(pattern, search_type)
+compile_pattern2(pattern, search_type, comp_pattern)
char *pattern;
int search_type;
+ void **comp_pattern;
{
if ((search_type & SRCH_NO_REGEX) == 0)
{
#if HAVE_POSIX_REGCOMP
- regex_t *s = (regex_t *) ecalloc(1, sizeof(regex_t));
- if (regcomp(s, pattern, REGCOMP_FLAG))
+ regex_t *comp = (regex_t *) ecalloc(1, sizeof(regex_t));
+ regex_t **pcomp = (regex_t **) comp_pattern;
+ if (regcomp(comp, pattern, REGCOMP_FLAG))
{
- free(s);
+ free(comp);
error("Invalid pattern", NULL_PARG);
return (-1);
}
- if (regpattern != NULL)
- regfree(regpattern);
- regpattern = s;
+ if (*pcomp != NULL)
+ regfree(*pcomp);
+ *pcomp = comp;
#endif
#if HAVE_PCRE
pcre *comp;
+ pcre **pcomp = (pcre **) comp_pattern;
const char *errstring;
int erroffset;
PARG parg;
error("%s", &parg);
return (-1);
}
- regpattern = comp;
+ *pcomp = comp;
#endif
#if HAVE_RE_COMP
PARG parg;
+ int *pcomp = (int *) comp_pattern;
if ((parg.p_string = re_comp(pattern)) != NULL)
{
error("%s", &parg);
return (-1);
}
- re_pattern = 1;
+ *pcomp = 1;
#endif
#if HAVE_REGCMP
- char *s;
- if ((s = regcmp(pattern, 0)) == NULL)
+ char *comp;
+ char **pcomp = (char **) comp_pattern;
+ if ((comp = regcmp(pattern, 0)) == NULL)
{
error("Invalid pattern", NULL_PARG);
return (-1);
}
- if (cpattern != NULL)
- free(cpattern);
- cpattern = s;
+ if (pcomp != NULL)
+ free(*pcomp);
+ *pcomp = comp;
#endif
#if HAVE_V8_REGCOMP
- struct regexp *s;
- if ((s = regcomp(pattern)) == NULL)
+ struct regexp *comp;
+ struct regexp **pcomp = (struct regexp **) comp_pattern;
+ if ((comp = regcomp(pattern)) == NULL)
{
/*
* regcomp has already printed an error message
*/
return (-1);
}
- if (regpattern != NULL)
- free(regpattern);
- regpattern = s;
+ if (*pcomp != NULL)
+ free(*pcomp);
+ *pcomp = comp;
#endif
}
- if (last_pattern != NULL)
- free(last_pattern);
- last_pattern = (char *) calloc(1, strlen(pattern)+1);
- if (last_pattern != NULL)
- strcpy(last_pattern, pattern);
-
- last_search_type = search_type;
+ if (comp_pattern == (void **) &search_pattern)
+ {
+ if (last_pattern != NULL)
+ free(last_pattern);
+ last_pattern = (char *) calloc(1, strlen(pattern)+1);
+ if (last_pattern != NULL)
+ strcpy(last_pattern, pattern);
+ last_search_type = search_type;
+ } else
+ {
+ last_filter_type = search_type;
+ }
return (0);
}
/*
- * Like compile_pattern, but convert the pattern to lowercase if necessary.
+ * Like compile_pattern2, but convert the pattern to lowercase if necessary.
*/
static int
-compile_pattern(pattern, search_type)
+compile_pattern(pattern, search_type, comp_pattern)
char *pattern;
int search_type;
+ void **comp_pattern;
{
char *cvt_pattern;
int result;
cvt_pattern = (char*) ecalloc(1, cvt_length(strlen(pattern), CVT_TO_LC));
cvt_text(cvt_pattern, pattern, (int *)NULL, CVT_TO_LC);
}
- result = compile_pattern2(cvt_pattern, search_type);
+ result = compile_pattern2(cvt_pattern, search_type, comp_pattern);
if (cvt_pattern != pattern)
free(cvt_pattern);
return (result);
* Forget that we have a compiled pattern.
*/
static void
-uncompile_pattern()
+uncompile_pattern(pattern)
+ void **pattern;
{
#if HAVE_POSIX_REGCOMP
- if (regpattern != NULL)
- regfree(regpattern);
- regpattern = NULL;
+ regex_t **pcomp = (regex_t **) pattern;
+ if (*pcomp != NULL)
+ regfree(*pcomp);
+ *pcomp = NULL;
#endif
#if HAVE_PCRE
- if (regpattern != NULL)
- pcre_free(regpattern);
- regpattern = NULL;
+ pcre **pcomp = (pcre **) pattern;
+ if (*pcomp != NULL)
+ pcre_free(*pcomp);
+ *pcomp = NULL;
#endif
#if HAVE_RE_COMP
- re_pattern = 0;
+ int *pcomp = (int *) pattern;
+ *pcomp = 0;
#endif
#if HAVE_REGCMP
- if (cpattern != NULL)
- free(cpattern);
- cpattern = NULL;
+ char **pcomp = (char **) pattern;
+ if (*pcomp != NULL)
+ free(*pcomp);
+ *pcomp = NULL;
#endif
#if HAVE_V8_REGCOMP
- if (regpattern != NULL)
- free(regpattern);
- regpattern = NULL;
+ struct regexp **pcomp = (struct regexp **) pattern;
+ if (*pcomp != NULL)
+ free(*pcomp);
+ *pcomp = NULL;
#endif
+}
+
+ static void
+uncompile_search_pattern()
+{
+ uncompile_pattern(&search_pattern);
last_pattern = NULL;
}
+ static void
+uncompile_filter_pattern()
+{
+ uncompile_pattern(&filter_pattern);
+}
+
+/*
+ * Is a compiled pattern null?
+ */
+ static int
+is_null_pattern(pattern)
+ void *pattern;
+{
+#if HAVE_POSIX_REGCOMP
+ return (pattern == NULL);
+#endif
+#if HAVE_PCRE
+ return (pattern == NULL);
+#endif
+#if HAVE_RE_COMP
+ return (pattern == 0);
+#endif
+#if HAVE_REGCMP
+ return (pattern == NULL);
+#endif
+#if HAVE_V8_REGCOMP
+ return (pattern == NULL);
+#endif
+}
+
/*
* Perform a pattern match with the previously compiled pattern.
* Set sp and ep to the start and end of the matched string.
*/
static int
-match_pattern(line, line_len, sp, ep, notbol)
+match_pattern(pattern, line, line_len, sp, ep, notbol, search_type)
+ void *pattern;
char *line;
int line_len;
char **sp;
char **ep;
int notbol;
+ int search_type;
{
int matched;
+#if HAVE_POSIX_REGCOMP
+ regex_t *spattern = (regex_t *) pattern;
+#endif
+#if HAVE_PCRE
+ pcre *spattern = (pcre *) pattern;
+#endif
+#if HAVE_RE_COMP
+ int spattern = (int) pattern;
+#endif
+#if HAVE_REGCMP
+ char *spattern = (char *) pattern;
+#endif
+#if HAVE_V8_REGCOMP
+ struct regexp *spattern = (struct regexp *) pattern;
+#endif
- if (last_search_type & SRCH_NO_REGEX)
+ if (search_type & SRCH_NO_REGEX)
return (match(last_pattern, strlen(last_pattern), line, line_len, sp, ep));
#if HAVE_POSIX_REGCOMP
{
regmatch_t rm;
int flags = (notbol) ? REG_NOTBOL : 0;
- matched = !regexec(regpattern, line, 1, &rm, flags);
- if (!matched)
- return (0);
+ matched = !regexec(spattern, line, 1, &rm, flags);
+ if (matched)
+ {
#ifndef __WATCOMC__
- *sp = line + rm.rm_so;
- *ep = line + rm.rm_eo;
+ *sp = line + rm.rm_so;
+ *ep = line + rm.rm_eo;
#else
- *sp = rm.rm_sp;
- *ep = rm.rm_ep;
+ *sp = rm.rm_sp;
+ *ep = rm.rm_ep;
#endif
+ }
}
#endif
#if HAVE_PCRE
{
int flags = (notbol) ? PCRE_NOTBOL : 0;
int ovector[3];
- matched = pcre_exec(regpattern, NULL, line, line_len,
+ matched = pcre_exec(spattern, NULL, line, line_len,
0, flags, ovector, 3) >= 0;
- if (!matched)
- return (0);
- *sp = line + ovector[0];
- *ep = line + ovector[1];
+ if (matched)
+ {
+ *sp = line + ovector[0];
+ *ep = line + ovector[1];
+ }
}
#endif
#if HAVE_RE_COMP
*sp = *ep = NULL;
#endif
#if HAVE_REGCMP
- *ep = regex(cpattern, line);
+ *ep = regex(spattern, line);
matched = (*ep != NULL);
- if (!matched)
- return (0);
- *sp = __loc1;
+ if (matched)
+ *sp = __loc1;
#endif
#if HAVE_V8_REGCOMP
#if HAVE_REGEXEC2
- matched = regexec2(regpattern, line, notbol);
+ matched = regexec2(spattern, line, notbol);
#else
- matched = regexec(regpattern, line);
+ matched = regexec(spattern, line);
#endif
- if (!matched)
- return (0);
- *sp = regpattern->startp[0];
- *ep = regpattern->endp[0];
+ if (matched)
+ {
+ *sp = spattern->startp[0];
+ *ep = spattern->endp[0];
+ }
#endif
#if NO_REGEX
matched = match(last_pattern, strlen(last_pattern), line, line_len, sp, ep);
#endif
+ matched = (!(search_type & SRCH_NO_MATCH) && matched) ||
+ ((search_type & SRCH_NO_MATCH) && !matched);
return (matched);
}
* Clear the hilite list.
*/
public void
-clr_hilite()
+clr_hlist(anchor)
+ struct hilite *anchor;
{
struct hilite *hl;
struct hilite *nexthl;
- for (hl = hilite_anchor.hl_first; hl != NULL; hl = nexthl)
+ for (hl = anchor->hl_first; hl != NULL; hl = nexthl)
{
nexthl = hl->hl_next;
free((void*)hl);
}
- hilite_anchor.hl_first = NULL;
+ anchor->hl_first = NULL;
prep_startpos = prep_endpos = NULL_POSITION;
}
+ public void
+clr_hilite()
+{
+ clr_hlist(&hilite_anchor);
+}
+
+ public void
+clr_filter()
+{
+ clr_hlist(&filter_anchor);
+}
+
/*
* Should any characters in a specified range be highlighted?
*/
return (0);
}
+/*
+ * Is a line "filtered" -- that is, should it be hidden?
+ */
+ public int
+is_filtered(pos)
+ POSITION pos;
+{
+ struct hilite *hl;
+
+ if (ch_getflags() & CH_HELPFILE)
+ return (0);
+
+ /*
+ * Look at each filter and see if the start position
+ * equals the start position of the line.
+ */
+ for (hl = filter_anchor.hl_first; hl != NULL; hl = hl->hl_next)
+ {
+ if (hl->hl_startpos == pos)
+ return (1);
+ }
+ return (0);
+}
+
/*
* Should any characters in a specified range be highlighted?
* If nohide is nonzero, don't consider hide_hilite.
int checkstart;
POSITION opos;
POSITION npos;
+ POSITION hl_opos;
+ POSITION hl_npos;
LWCHAR ch;
int ncwidth;
line_end = line + line_len;
opos = npos = linepos;
hl = anchor->hl_first;
+ if (hl == NULL)
+ return;
+ hl_opos = hl_npos = hl->hl_startpos;
checkstart = TRUE;
- while (hl != NULL)
+
+ while (hl != NULL && line < line_end)
{
/*
* See if we need to adjust the current hl_startpos or
* The hilite list must be sorted thus:
* startpos[0] < endpos[0] <= startpos[1] < endpos[1] <= etc.
*/
- if (checkstart && hl->hl_startpos == opos)
- {
- hl->hl_startpos = npos;
- checkstart = FALSE;
- continue; /* {{ not really necessary }} */
- } else if (!checkstart && hl->hl_endpos == opos)
- {
- hl->hl_endpos = npos;
- checkstart = TRUE;
- hl = hl->hl_next;
- continue; /* {{ necessary }} */
- }
- if (line == line_end)
- break;
-
- /* Get the next char from the line. */
oline = line;
ch = step_char(&line, +1, line_end);
ncwidth = line - oline;
/* Ordinary unprocessed character. */
opos += ncwidth;
}
+
+ if (opos == hl_opos) {
+ /* Adjust highlight position. */
+ hl_npos = npos;
+ }
+ if (opos > hl_opos)
+ {
+ /*
+ * We've moved past the highlight position; store the
+ * adjusted highlight position and move to the next highlight.
+ */
+ if (checkstart)
+ {
+ hl->hl_startpos = hl_npos;
+ hl_opos = hl->hl_endpos;
+ checkstart = FALSE;
+ } else
+ {
+ hl->hl_endpos = hl_npos;
+ hl = hl->hl_next;
+ if (hl != NULL)
+ hl_opos = hl->hl_startpos;
+ checkstart = TRUE;
+ }
+ hl_npos = npos;
+ }
}
}
searchp++;
else /* end of line */
break;
- } while (match_pattern(searchp, line_end - searchp, &sp, &ep, 1));
+ } while (match_pattern(search_pattern, searchp, line_end - searchp, &sp, &ep, 1, last_search_type));
/*
* If there were backspaces in the original line, they
* Pattern did have uppercase.
* Discard the pattern; we can't change search caselessness now.
*/
- uncompile_pattern();
+ uncompile_search_pattern();
}
#if HILITE_SEARCH
add_lnum(linenum, pos);
oldpos = pos;
+ if (is_filtered(linepos))
+ continue;
+
/*
* If it's a caseless search, convert the line to lowercase.
* If we're doing backspace processing, delete backspaces.
cline = calloc(1, cvt_length(line_len, cvt_ops));
cvt_text(cline, line, &line_len, cvt_ops);
+#if HILITE_SEARCH
/*
- * Test the next line to see if we have a match.
- * We are successful if we either want a match and got one,
- * or if we want a non-match and got one.
+ * Check to see if the line matches the filter pattern.
+ * If so, add an entry to the filter list.
*/
- line_match = match_pattern(cline, line_len, &sp, &ep, 0);
- line_match = (!(search_type & SRCH_NO_MATCH) && line_match) ||
- ((search_type & SRCH_NO_MATCH) && !line_match);
- if (!line_match)
+ if ((search_type & SRCH_FIND_ALL) &&
+ !is_null_pattern(filter_pattern))
{
- free(cline);
- continue;
+ int line_filter = match_pattern(filter_pattern,
+ cline, line_len, &sp, &ep, 0, last_filter_type);
+ if (line_filter)
+ {
+ struct hilite *hl = (struct hilite *)
+ ecalloc(1, sizeof(struct hilite));
+ hl->hl_startpos = linepos;
+ hl->hl_endpos = pos;
+ add_hilite(&filter_anchor, hl);
+ }
}
+#endif
+
/*
- * Got a match.
+ * Test the next line to see if we have a match.
+ * We are successful if we either want a match and got one,
+ * or if we want a non-match and got one.
*/
- if (search_type & SRCH_FIND_ALL)
+ if (!is_null_pattern(search_pattern))
{
-#if HILITE_SEARCH
- /*
- * We are supposed to find all matches in the range.
- * Just add the matches in this line to the
- * hilite list and keep searching.
- */
+ line_match = match_pattern(search_pattern,
+ cline, line_len, &sp, &ep, 0, search_type);
if (line_match)
- hilite_line(linepos, cline, line_len, sp, ep, cvt_ops);
-#endif
- free(cline);
- } else if (--matches <= 0)
- {
- /*
- * Found the one match we're looking for.
- * Return it.
- */
-#if HILITE_SEARCH
- if (hilite_search == OPT_ON)
{
/*
- * Clear the hilite list and add only
- * the matches in this one line.
+ * Got a match.
*/
- clr_hilite();
- if (line_match)
+ if (search_type & SRCH_FIND_ALL)
+ {
+#if HILITE_SEARCH
+ /*
+ * We are supposed to find all matches in the range.
+ * Just add the matches in this line to the
+ * hilite list and keep searching.
+ */
hilite_line(linepos, cline, line_len, sp, ep, cvt_ops);
- }
#endif
- free(cline);
- if (plinepos != NULL)
- *plinepos = linepos;
- return (0);
+ } else if (--matches <= 0)
+ {
+ /*
+ * Found the one match we're looking for.
+ * Return it.
+ */
+#if HILITE_SEARCH
+ if (hilite_search == OPT_ON)
+ {
+ /*
+ * Clear the hilite list and add only
+ * the matches in this one line.
+ */
+ clr_hilite();
+ hilite_line(linepos, cline, line_len, sp, ep, cvt_ops);
+ }
+#endif
+ free(cline);
+ if (plinepos != NULL)
+ *plinepos = linepos;
+ return (0);
+ }
+ }
}
+ free(cline);
}
}
- /*
+/*
* search for a pattern in history. If found, compile that pattern.
*/
static int
if (pattern == NULL)
return (0);
- if (compile_pattern(pattern, search_type) < 0)
+ if (compile_pattern(pattern, search_type, &search_pattern) < 0)
return (0);
is_ucase_pattern = is_ucase(pattern);
int n;
{
POSITION pos;
- int result;
if (pattern == NULL || *pattern == '\0')
{
/*
* Compile the pattern.
*/
- if (compile_pattern(pattern, search_type) < 0)
+ if (compile_pattern(pattern, search_type, &search_pattern) < 0)
return (-1);
/*
* Ignore case if -I is set OR
*/
#define SEARCH_MORE (3*size_linebuf)
- if (!prev_pattern())
+ if (!prev_pattern() && !is_filtering())
return;
/*
* Discard the old prep region and start a new one.
*/
clr_hilite();
+ clr_filter();
if (epos != NULL_POSITION)
epos += SEARCH_MORE;
nprep_startpos = spos;
prep_startpos = nprep_startpos;
prep_endpos = nprep_endpos;
}
+
+/*
+ * Set the pattern to be used for line filtering.
+ */
+ public void
+set_filter_pattern(pattern, search_type)
+ char *pattern;
+ int search_type;
+{
+ clr_filter();
+ if (pattern == NULL || *pattern == '\0')
+ uncompile_filter_pattern();
+ else
+ compile_pattern(pattern, search_type, &filter_pattern);
+ screen_trashed = 1;
+}
+
+/*
+ * Is there a line filter in effect?
+ */
+ public int
+is_filtering()
+{
+ if (ch_getflags() & CH_HELPFILE)
+ return (0);
+ return !is_null_pattern(filter_pattern);
+}
#endif
/*
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
u_interrupt(type)
int type;
{
+ bell();
#if OS2
LSIGNAL(SIGINT, SIG_ACK);
#endif
getkey();
#endif
if (reading)
- intread();
+ intread(); /* May longjmp */
}
#ifdef SIGTSTP
{
if (quit_on_intr)
quit(QUIT_OK);
- bell();
- /*
- * {{ You may wish to replace the bell() with
- * error("Interrupt", NULL_PARG); }}
- */
-
- /*
- * If we were interrupted while in the "calculating
- * line numbers" loop, turn off line numbers.
- */
- if (lnloop)
- {
- lnloop = 0;
- if (linenums == 2)
- screen_trashed = 1;
- linenums = 0;
- error("Line numbers turned off", NULL_PARG);
- }
-
}
}
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
/*
- * Copyright (C) 1984-2007 Mark Nudelman
+ * Copyright (C) 1984-2008 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
/*
----------------------- CHANGE HISTORY --------------------------
- 1/29/84 Allowed use on standard input
- 2/1/84 Added E, N, P commands
- 4/17/84 Added '=' command, 'stop' signal handling
- 4/20/84 Added line folding
-v2 4/27/84 Fixed '=' command to use BOTTOM_PLUS_ONE,
- instead of TOP, added 'p' & 'v' commands
-v3 5/3/84 Added -m and -t options, '-' command
-v4 5/3/84 Added LESS environment variable
-v5 5/3/84 New comments, fixed '-' command slightly
-v6 5/15/84 Added -Q, visual bell
-v7 5/24/84 Fixed jump_back(n) bug: n should count real
- lines, not folded lines. Also allow number on G command.
-v8 5/30/84 Re-do -q and -Q commands
-v9 9/25/84 Added "+<cmd>" argument
-v10 10/10/84 Fixed bug in -b<n> argument processing
-v11 10/18/84 Made error() ring bell if \n not entered.
------------------------------------------------------------------
-v12 2/13/85 Reorganized signal handling and made portable to 4.2bsd.
-v13 2/16/85 Reword error message for '-' command.
-v14 2/22/85 Added -bf and -bp variants of -b.
-v15 2/25/85 Miscellaneous changes.
-v16 3/13/85 Added -u flag for backspace processing.
-v17 4/13/85 Added j and k commands, changed -t default.
-v18 4/20/85 Rewrote signal handling code.
-v19 5/2/85 Got rid of "verbose" eq_message().
- Made search() scroll in some cases.
-v20 5/21/85 Fixed screen.c ioctls for System V.
-v21 5/23/85 Fixed some first_cmd bugs.
-v22 5/24/85 Added support for no RECOMP nor REGCMP.
-v23 5/25/85 Miscellanous changes and prettying up.
- Posted to USENET.
------------------------------------------------------------------
-v24 6/3/85 Added ti,te terminal init & de-init.
- (Thanks to Mike Kersenbrock)
-v25 6/8/85 Added -U flag, standout mode underlining.
-v26 6/9/85 Added -M flag.
- Use underline termcap (us) if it exists.
-v27 6/15/85 Renamed some variables to make unique in
- 6 chars. Minor fix to -m.
-v28 6/28/85 Fixed right margin bug.
-v29 6/28/85 Incorporated M.Rose's changes to signal.c
-v30 6/29/85 Fixed stupid bug in argument processing.
-v31 7/15/85 Added -p flag, changed repaint algorithm.
- Added kludge for magic cookie terminals.
-v32 7/16/85 Added cat_file if output not a tty.
-v33 7/23/85 Added -e flag and EDITOR.
-v34 7/26/85 Added -s flag.
-v35 7/27/85 Rewrote option handling; added option.c.
-v36 7/29/85 Fixed -e flag to work if not last file.
-v37 8/10/85 Added -x flag.
-v38 8/19/85 Changed prompting; created prompt.c.
-v39 8/24/85 (Not -p) does not initially clear screen.
-v40 8/26/85 Added "skipping" indicator in forw().
- Posted to USENET.
------------------------------------------------------------------
-v41 9/17/85 ONLY_RETURN, control char commands,
- faster search, other minor fixes.
-v42 9/25/85 Added ++ command line syntax;
- ch_fsize for pipes.
-v43 10/15/85 Added -h flag, changed prim.c algorithms.
-v44 10/16/85 Made END print in all cases of eof;
- ignore SIGTTOU after receiv ing SIGTSTP.
-v45 10/16/85 Never print backspaces unless -u.
-v46 10/24/85 Backwards scroll in jump_loc.
-v47 10/30/85 Fixed bug in edit(): *first_cmd==0
-v48 11/16/85 Use TIOCSETN instead of TIOCSETP.
- Added marks (m and ' commands).
- Posted to USENET.
------------------------------------------------------------------
-v49 1/9/86 Fixed bug: signal didn't clear mcc.
-v50 1/15/86 Added ' (quote) to gomark.
-v51 1/16/86 Added + cmd, fixed problem if first_cmd
- fails, made g cmd sort of "work" on pipes
- ev en if bof is no longer buffered.
-v52 1/17/86 Made short files work better.
-v53 1/20/86 Added -P option.
-v54 1/20/86 Changed help to use HELPFILE.
-v55 1/23/86 Messages work better if not tty output.
-v56 1/24/86 Added -l option.
-v57 1/31/86 Fixed -l to get confirmation before
- ov erwriting an existing file.
-v58 8/28/86 Added filename globbing.
-v59 9/15/86 Fixed some bugs with very long filenames.
-v60 9/26/86 Incorporated changes from Leith (Casey)
- Leedom for boldface and -z option.
-v61 9/26/86 Got rid of annoying repaints after ! cmd.
- Posted to USENET.
------------------------------------------------------------------
-v62 12/23/86 Added is_directory(); change -z default to
- -1 instead of 24; cat-and-exit if -e and
- file is less than a screenful.
-v63 1/8/87 Fixed bug in cat-and-exit if > 1 file.
-v64 1/12/87 Changed puts/putstr, putc/putchr,
- getc/getchr to av oid name conflict with
- stdio functions.
-v65 1/26/87 Allowed '-' command to change NUMBER
- v alued options (thanks to Gary Puckering)
-v66 2/13/87 Fixed bug: prepaint should use force=1.
-v67 2/24/87 Added !! and % expansion to ! command.
-v68 2/25/87 Added SIGWINCH and TIOCGWINSZ support;
- changed is_directory to bad_file.
- (thanks to J. Robert Ward)
-v69 2/25/87 Added SIGWIND and WIOCGETD (for Unix PC).
-v70 3/13/87 Changed help cmd from 'h' to 'H'; better
- error msgs in bad_file, errno_message.
-v71 5/11/87 Changed -p to -c, made triple -c/-C
- for clear-eol like more's -c.
-v72 6/26/87 Added -E, -L, use $SHELL in lsystem().
- (thanks to Stev e Spearman)
-v73 6/26/87 Allow Examine "#" for previous file.
- Posted to USENET 8/25/87.
------------------------------------------------------------------
-v74 9/18/87 Fix conflict in EOF symbol with stdio.h,
- Make os.c more portable to BSD.
-v75 9/23/87 Fix problems in get_term (thanks to
- Paul Eggert); new backwards scrolling in
- jump_loc (thanks to Marion Hakanson).
-v76 9/23/87 Added -i flag; allow single "!" to
- inv oke a shell (thanks to Franco Barber).
-v77 9/24/87 Added -n flag and line number support.
-v78 9/25/87 Fixed problem with prompts longer than
- the screen width.
-v79 9/29/87 Added the _ command.
-v80 10/6/87 Allow signal to break out of linenum scan.
-v81 10/6/87 Allow -b to be changed from within less.
-v82 10/7/87 Add cmd_decode to use a table for key
- binding (thanks to Dav id Nason).
-v83 10/9/87 Allow .less file for user-defined keys.
-v84 10/11/87 Fix -e/-E problems (thanks to Felix Lee).
-v85 10/15/87 Search now keeps track of line numbers.
-v86 10/20/87 Added -B option and autobuf; fixed
- "pipe error" bug.
-v87 3/1/88 Fix bug re BSD signals while reading file.
-v88 3/12/88 Use new format for -P option (thanks to
- der Mouse), allow "+-c" without message,
- fix bug re BSD hangup.
-v89 3/18/88 Turn off line numbers if linenum scan
- is interrupted.
-v90 3/30/88 Allow -P from within less.
-v91 3/30/88 Added tags file support (new -t option)
- (thanks to Brian Campbell).
-v92 4/4/88 Added -+option syntax.
-v93 4/11/88 Add support for slow input (thanks to
- Joe Orost & apologies for taking almost
- 3 years to get this in!)
-v94 4/11/88 Redo reading/signal stuff.
-v95 4/20/88 Repaint screen better after signal.
-v96 4/21/88 Add /! and ?! commands.
-v97 5/17/88 Allow -l/-L from within less.
- Eliminate some static arrays (use calloc).
- Posted to USENET.
------------------------------------------------------------------
-v98 10/14/88 Fix incorrect calloc call; uninitialized
- var in exec_mca; core dump on unknown TERM.
- Make v cmd work if past last line of file.
- Fix some signal bugs.
-v99 10/29/88 Allow space between -X and string,
- when X is a string-valued option.
-v100 1/5/89 Fix globbing bug when $SHELL not set;
- allow spaces after -t command.
-v101 1/6/89 Fix problem with long (truncated) lines
- in tags file (thanks to Neil Dixon).
-v102 1/6/89 Fix bug with E# when no prev file;
- allow spaces after -l command.
-v103 3/14/89 Add -N, -f and -? options. Add z and w
- commands. Add %L for prompt strings.
-v104 3/16/89 Added EDITPROTO.
-v105 3/20/89 Fix bug in find_linenum which cached
- incorrectly on long lines.
-v106 3/31/89 Added -k option and multiple lesskey
- files.
-v107 4/27/89 Add 8-bit char support and -g option.
- Split option code into 3 files.
-v108 5/5/89 Allocate position table dynamically
- (thanks to Paul Eggert); change % command
- from "percent" to vi-style brace finder.
-v109 5/10/89 Added ESC-% command, split prim.c.
-v110 5/24/89 Fixed bug in + option; fixed repaint bug
- under Sun windows (thanks to Paul Eggert).
-v111 5/25/89 Generalized # and % expansion; use
- calloc for some error messages.
-v112 5/30/89 Get rid of ESC-%, add {}()[] commands.
-v113 5/31/89 Optimize lseeks (thanks to Paul Eggert).
-v114 7/25/89 Added ESC-/ and ESC-/! commands.
-v115 7/26/89 Added ESC-n command.
-v116 7/31/89 Added find_pos to optimize g command.
-v117 8/1/89 Change -f option to -r.
-v118 8/2/89 Save positions for all previous files,
- not just the immediately previous one.
-v119 8/7/89 Save marks across file boundaries.
- Add file handle stuff.
-v120 8/11/89 Add :ta command.
-v121 8/16/89 Add -f option.
-v122 8/30/89 Fix performance with many buffers.
-v123 8/31/89 Verbose prompts for string options.
- Posted beta to USENET.
------------------------------------------------------------------
-v124 9/18/89 Reorganize search commands,
- N = rev, ESC-n = span, add ESC-N.
-v125 9/18/89 Fix tab bug (thanks to Alex Liu).
- Fix EOF bug when both -w and -c.
-v126 10/25/89 Add -j option.
-v127 10/27/89 Fix problems with blank lines before BOF.
-v128 10/27/89 Add %bj, etc. to prompt strings.
-v129 11/3/89 Add -+,-- commands; add set-option and
- unset-option to lesskey.
-v130 11/6/89 Generalize A_EXTRA to string, remove
- set-option, unset-option from lesskey.
-v131 11/7/89 Changed name of EDITPROTO to LESSEDIT.
-v132 11/8/89 Allow editing of command prefix.
-v133 11/16/89 Add -y option (thanks to Jeff Sullivan).
-v134 12/1/89 Glob filenames in the -l command.
-v135 12/5/89 Combined {}()[] commands into one, and
- added ESC-^F and ESC-^B commands.
-v136 1/20/90 Added -S, -R flags. Added | command.
- Added warning for binary files. (thanks
- to Richard Brittain and J. Sullivan).
-v137 1/21/90 Rewrote horrible pappend code.
- Added * notation for hi-bit chars.
-v138 1/24/90 Fix magic cookie terminal handling.
- Get rid of "cleanup" loop in ch_get.
-v139 1/27/90 Added MSDOS support. (many thanks
- to Richard Brittain).
-v140 2/7/90 Editing a new file adds it to the
- command line list.
-v141 2/8/90 Add edit_list for editing >1 file.
-v142 2/10/90 Add :x command.
-v143 2/11/90 Add * and @ modifies to search cmds.
- Change ESC-/ cmd from /@* to / *.
-v144 3/1/90 Messed around with ch_zero;
- no real change.
-v145 3/2/90 Added -R and -v/-V for MSDOS;
- renamed FILENAME to avoid conflict.
-v146 3/5/90 Pull cmdbuf functions out of command.c
-v147 3/7/90 Implement ?@; fix multi-file edit bugs.
-v148 3/29/90 Fixed bug in :e<file> then :e#.
-v149 4/3/90 Change error,ierror,query to use PARG.
-v150 4/6/90 Add LESS_CHARSET, LESS_CHARDEF.
-v151 4/13/90 Remove -g option; clean up ispipe.
-v152 4/14/90 lsystem() closes input file, for
- editors which require exclusive open.
-v153 4/18/90 Fix bug if SHELL unset;
- fix bug in overstrike control char.
-v154 4/25/90 Output to fd 2 via buffer.
-v155 4/30/90 Ignore -i if uppercase in pattern
- (thanks to Michael Rendell.)
-v156 5/3/90 Remove scroll limits in forw() & back();
- causes problems with -c.
-v157 5/4/90 Forward search starts at next real line
- (not screen line) after jump target.
-v158 6/14/90 Added F command.
-v159 7/29/90 Fix bug in exiting: output not flushed.
-v160 7/29/90 Clear screen before initial output w/ -c.
-v161 7/29/90 Add -T flag.
-v162 8/14/90 Fix bug with +F on command line.
-v163 8/21/90 Added LESSBINFMT variable.
-v164 9/5/90 Added -p, LINES, COLUMNS and
- unset mark ' == BOF, for 1003.2 D5.
-v165 9/6/90 At EOF with -c set, don't display empty
- screen when try to page forward.
-v166 9/6/90 Fix G when final line in file wraps.
-v167 9/11/90 Translate CR/LF -> LF for 1003.2.
-v168 9/13/90 Return to curr file if "tag not found".
-v169 12/12/90 G goes to EOF even if file has grown.
-v170 1/17/91 Add optimization for BSD _setjmp;
- fix #include ioctl.h TERMIO problem.
- (thanks to Paul Eggert)
- Posted to USENET.
------------------------------------------------------------------
-v171 3/6/91 Fix -? bug in get_filename.
-v172 3/15/91 Fix G bug in empty file.
- Fix bug with ?\n and -i and uppercase
- pattern at EOF!
- (thanks to Paul Eggert)
-v173 3/17/91 Change N cmd to not permanently change
- direction. (thanks to Brian Matthews)
-v174 3/18/91 Fix bug with namelogfile not getting
- cleared when change files.
-v175 3/18/91 Fix bug with ++cmd on command line.
- (thanks to Jim Meyering)
-v176 4/2/91 Change | to not force current screen,
- include marked line, start/end from
- top of screen. Improve search speed.
- (thanks to Don Mears)
-v177 4/2/91 Add LESSHELP variable.
- Fix bug with F command with -e.
- Try /dev/tty for input before using fd 2.
- Patches posted to USENET 4/2/91.
------------------------------------------------------------------
-v178 4/8/91 Fixed bug in globbing logfile name.
- (thanks to Jim Meyering)
-v179 4/9/91 Allow negative -z for screen-relative.
-v180 4/9/91 Clear to eos rather than eol if "db";
- don't use "sr" if "da".
- (thanks to Tor Lillqvist)
-v181 4/18/91 Fixed bug with "negative" chars 80 - FF.
- (thanks to Benny Sander Hofmann)
-v182 5/16/91 Fixed bug with attribute at EOL.
- (thanks to Brian Matthews)
-v183 6/1/91 Rewrite linstall to do smart config.
-v184 7/11/91 Process \b in searches based on -u
- rather than -i.
-v185 7/11/91 -Pxxx sets short prompt; assume SIGWINCH
- after a SIGSTOP. (thanks to Ken Laprade)
------------------------------------------------------------------
-v186 4/20/92 Port to MS-DOS (Microsoft C).
-v187 4/23/92 Added -D option & TAB_COMPLETE_FILENAME.
-v188 4/28/92 Added command line editing features.
-v189 12/8/92 Fix mem overrun in anscreen.c:init;
- fix edit_list to recover from bin file.
-v190 2/13/93 Make TAB enter one filename at a time;
- create ^L with old TAB functionality.
-v191 3/10/93 Defer creating "flash" page for MS-DOS.
-v192 9/6/93 Add BACK-TAB.
-v193 9/17/93 Simplify binary_file handling.
-v194 1/4/94 Add rudiments of alt_filename handling.
-v195 1/11/94 Port back to Unix; support keypad.
------------------------------------------------------------------
-v196 6/7/94 Fix bug with bad filename; fix IFILE
- type problem. (thanks to David MacKenzie)
-v197 6/7/94 Fix bug with .less tables inserted wrong.
-v198 6/23/94 Use autoconf installation technology.
- (thanks to David MacKenzie)
-v199 6/29/94 Fix MS-DOS build (thanks to Tim Wiegman).
-v200 7/25/94 Clean up copyright, minor fixes.
- Posted to prep.ai.mit.edu
------------------------------------------------------------------
-v201 7/27/94 Check for no memcpy; add casts to calloc;
- look for regcmp in libgen.a.
- (thanks to Kaveh Ghazi).
-v202 7/28/94 Fix bug in edit_next/edit_prev with
- non-existant files.
-v203 8/2/94 Fix a variety of configuration bugs on
- various systems. (thanks to Sakai
- Kiyotaka, Harald Koenig, Bjorn Brox,
- Teemu Rantanen, and Thorsten Lockert)
-v204 8/3/94 Use strerror if available.
- (thanks to J.T. Conklin)
-v205 8/5/94 Fix bug in finding "me" termcap entry.
- (thanks to Andreas Stolcke)
-8/10/94 v205+: Change BUFSIZ to LBUFSIZE to avoid name
- conflict with stdio.h.
- Posted to prep.ai.mit.edu
------------------------------------------------------------------
-v206 8/10/94 Use initial_scrpos for -t to avoid
- displaying first page before init().
- (thanks to Dominique Petitpierre)
-v207 8/12/94 Fix bug if stdout is not tty.
-v208 8/16/94 Fix bug in close_altfile if goto err1
- in edit_ifile. (Thanks to M.J. Hewitt)
-v209 8/16/94 Change scroll to wscroll to avoid
- conflict with library function.
-v210 8/16/94 Fix bug with bold on 8 bit chars.
- (thanks to Vitor Duarte)
-v211 8/16/94 Don't quit on EOI in jump_loc / forw.
-v212 8/18/94 Use time_t if available.
-v213 8/20/94 Allow ospeed to be defined in termcap.h.
-v214 8/20/94 Added HILITE_SEARCH, -F, ESC-u cmd.
- (thanks to Paul Lew and Bob Byrnes)
-v215 8/23/94 Fix -i toggle behavior.
-v216 8/23/94 Process BS in all searches, not only -u.
-v217 8/24/94 Added -X flag.
-v218 8/24/94 Reimplement undo_search.
-v219 8/24/94 Find tags marked with line number
- instead of pattern.
-v220 8/24/94 Stay at same position after SIG_WINCH.
-v221 8/24/94 Fix bug in file percentage in big file.
-v222 8/25/94 Do better if can't reopen current file.
-v223 8/27/94 Support setlocale.
- (thanks to Robert Joop)
-v224 8/29/94 Revert v216: process BS in search
- only if -u.
-v225 9/6/94 Rewrite undo_search again: toggle.
-v226 9/15/94 Configuration fixes.
- (thanks to David MacKenzie)
-v227 9/19/94 Fixed strerror config problem.
- Posted to prep.ai.mit.edu
------------------------------------------------------------------
-v228 9/21/94 Fix bug in signals: repeated calls to
- get_editkeys overflowed st_edittable.
-v229 9/21/94 Fix "Nothing to search" error if -a
- and SRCH_PAST_EOF.
-v230 9/21/94 Don't print extra error msg in search
- after regerror().
-v231 9/22/94 Fix hilite bug if search matches 0 chars.
- (thanks to John Polstra)
-v232 9/23/94 Deal with weird systems that have
- termios.h but not tcgetattr().
- Posted to prep.ai.mit.edu
------------------------------------------------------------------
-v233 9/26/94 Use get_term() instead of pos_init() in
- psignals to re-get lower_left termcap.
- (Thanks to John Malecki)
-v234 9/26/94 Make MIDDLE closer to middle of screen.
-v235 9/27/94 Use local strchr if system doesn't have.
-v236 9/28/94 Don't use libucb; use libterm if
- libtermcap & libcurses doesn't work.
- (Fix for Solaris; thanks to Frank Kaefer)
-v237 9/30/94 Use system isupper() etc if provided.
- Posted to prep.ai.mit.edu
------------------------------------------------------------------
-v238 10/6/94 Make binary non-blinking if LESSBINFMT
- is set to a string without a *.
-v239 10/7/94 Don't let delimit_word run back past
- beginning of cmdbuf.
-v240 10/10/94 Don't write into termcap buffer.
- (Thanks to Benoit Speckel)
-v241 10/13/94 New lesskey file format.
- Don't expand filenames in search command.
-v242 10/14/94 Allow lesskey specification of "literal".
-v243 10/14/94 Add #stop command to lesskey.
-v244 10/16/94 Add -f flag to lesskey.
-v245 10/25/94 Allow TAB_COMPLETE_FILENAME to be undefd.
-v246 10/27/94 Move help file to /usr/local/share.
-v247 10/27/94 Add -V option.
-v248 11/5/94 Add -V option to lesskey.
-v249 11/5/94 Remove -f flag from lesskey; default
- input file is ~/.lesskey.in, not stdin.
-v250 11/7/94 Lesskey input file "-" means stdin.
-v251 11/9/94 Convert cfgetospeed result to ospeed.
- (Thanks to Andrew Chernov)
-v252 11/16/94 Change default lesskey input file from
- .lesskey.in to .lesskey.
- Posted to prep.ai.mit.edu
------------------------------------------------------------------
-v253 11/21/94 Fix bug when tags file has a backslash.
-v254 12/6/94 Fix -k option.
-v255 12/8/94 Add #define EXAMINE to disable :e etc.
-v256 12/10/94 Change highlighting: only highlite search
- results (but now it is reliable).
-v257 12/10/94 Add goto_line and repaint_highlight
- to optimize highlight repaints.
-v258 12/12/94 Fixup in hilite_line if BS_SPECIAL.
-v259 12/12/94 Convert to autoconf 2.0.
-v260 12/13/94 Add SECURE define.
-v261 12/14/94 Use system WERASE char as EC_W_BACKSPACE.
-v262 12/16/94 Add -g/-G flag and screen_hilite.
-v263 12/20/94 Reimplement/optimize -G flag behavior.
-v264 12/23/94 Allow EXTRA string after line-edit cmd
- in lesskey file.
-v265 12/24/94 Add LESSOPEN=|cmd syntax.
-v266 12/26/94 Add -I flag.
-v267 12/28/94 Formalize the four-byte header emitted
- by a LESSOPEN pipe.
-v268 12/28/94 Get rid of four-byte header.
-v269 1/2/95 Close alt file before open new one.
- Avoids multiple popen().
-v270 1/3/95 Use VISUAL; use S_ISDIR/S_ISREG; fix
- config problem with Solaris POSIX regcomp.
-v271 1/4/95 Don't quit on read error.
-v272 1/5/95 Get rid of -L.
-v273 1/6/95 Fix ch_ungetchar bug; don't call
- LESSOPEN on a pipe.
-v274 1/6/95 Ported to OS/2 (thanks to Kai Uwe Rommel)
-v275 1/18/95 Fix bug if toggle -G at EOF.
-v276 1/30/95 Fix OS/2 version.
-v277 1/31/95 Add "next" charset; don't display ^X
- for X > 128.
-v278 2/14/95 Change default for -G.
- Posted to prep.ai.mit.edu
------------------------------------------------------------------
-v279 2/22/95 Add GNU options --help, --version.
- Minor config fixes.
-v280 2/24/95 Clean up calls to glob(); don't set #
- if we can't open the new file.
-v281 2/24/95 Repeat search should turn on hilites.
-v282 3/2/95 Minor fixes.
-v283 3/2/95 Fix homefile; make OS2 look in $HOME.
-v284 3/2/95 Error if "v" on LESSOPENed file;
- "%" figures out file size on pipe.
-v285 3/7/95 Don't set # in lsystem;
- lesskey try $HOME first.
-v286 3/7/95 Reformat change history (too much free time?).
-v287 3/8/95 Fix hilite bug if overstrike multiple chars.
-v288 3/8/95 Allow lesskey to override get_editkey keys.
-v289 3/9/95 Fix adj_hilite bug when line gets processed by
- hilite_line more than once.
-v290 3/9/95 Make configure automatically. Fix Sequent problem
- with incompatible sigsetmask().
- Posted to prep.ai.mit.edu
------------------------------------------------------------------
-v291 3/21/95 Add #env to lesskey. Fix MS-DOS build.
- Posted to simtel.
------------------------------------------------------------------
-v292 4/24/95 Add MS-DOS support for Borland C.
- Fix arrow keys in MS-DOS versions.
-v293 4/28/95 Add auto-versioning stuff to make dist.
-v294 5/12/95 Fix Borland build.
-v295 1/20/96 Fix search on squished file; add /@@.
-v296 1/23/96 Allow cmdbuf larger than screen width.
-v297 1/24/96 Don't call termcap if tgetent fails;
- add #defines for buffers.
-v298 1/24/96 Change @@ to ^K.
- Add alternate search modifiers ^N, ^F, ^E.
-v299 1/25/96 Fix percent overflow in jump_percent (thanks to Brent Wiese);
- don't send "ti" after shell command till RETURN pressed.
-v300 1/25/96 Change -U to print tabs as ^I.
-v301 1/30/96 Make hilites work in cmd F output.
-v302 1/31/96 Fix cmd F to notice window-change signals.
-v303 1/31/96 Add ESC-SPACE command.
-v304 2/1/96 Add ^R search modifier; add LESSSECURE.
-v305 2/2/96 Workaround Linux /proc kernel bug; add LESSKEY.
-v306 3/16/96 Minor fixes.
-v307 3/25/96 Allow cmd line arg "--"; fix DOS & OS/2 defines.h.
-v308 4/4/96 Port to OS-9 (thanks to Boisy Pitre); fix -d.
-v309 4/9/96 Fix OS-9 version; fix tags bug with "$".
-v310 4/10/96 Get rid of HELPFILE.
-v311 4/22/96 Add Windows32 support; merge doscreen.c into screen.c.
-v312 4/24/96 Don't quit after "cannot reopen" error.
-v313 4/25/96 Added horizontal scrolling.
-v314 4/26/96 Modified -e to quit on reaching end of a squished file.
-v315 4/26/96 Fix "!;TAB" bug.
-v316 5/2/96 Make "|a" when (a < curr screen) go to end of curr screen.
-v317 5/14/96 Various fixes for the MS-DOS and OS/2 builds.
- Added ## and %% handling for filenames
-v318 5/29/96 Port to OS-9 Microware compiler; minor fixes
- (thanks to Martin Gregorie).
-v319 7/8/96 Fix Windows port (thanks to Jeff Paquette).
-v320 7/11/96 Final fixes for Windows port.
-v321 7/18/96 Minor fixes.
- Posted to Web page.
------------------------------------------------------------------
-v322 8/13/96 Fix bug in shell escape from help file; add support for
- Microsoft Visual C under Windows; numerous small fixes.
-v323 8/19/96 Fixes for Windows version (thanks to Simon Munton);
- fix for Linux library weirdness (thanks to Jim Diamond);
- port to DJGPP (thanks to Eli Zaretskii).
-v324 8/21/96 Add support for spaces in filenames (thanks to Simon Munton).
-v325 8/21/96 Add lessecho, for spaces in filenames under Unix.
-v326 8/27/96 Fix DJGPP version.
-v327 9/1/96 Reorganize lglob, make spaces in filenames work better in Unix.
-v328 10/7/96 Append / to directory name in filename completion.
- Fix MS-DOS and OS-9 versions.
-v329 10/11/96 Fix more MS-DOS bugs; add LESSSEPARATOR; add -" option.
- Add LESSMETACHARS, LESSMETAESCAPE.
-v330 10/21/96 Minor fixes.
- Posted to Web page.
------------------------------------------------------------------
-v331 4/22/97 Various Windows fixes (thanks to Gurusamy Sarathy).
-v332 4/22/97 Enter filenames from cmd line into edit history.
- Posted to Web page.
------------------------------------------------------------------
-v333 3/4/99 Changed -w to highlite new line after forward movement.
-v334 3/9/99 Avoid overflowing prompt buffer; add %d and %D.
-v335 3/20/99 Add EBCDIC support (thanks to Thomas Dorner).
- Use HOMEDRIVE/HOMEPATH on Windows (thanks to Preston Bannister).
- Posted to Web page.
------------------------------------------------------------------
-v336 4/8/99 Fix installation bugs.
-v337 4/9/99 Fix another installation bug.
- Posted to Web page.
------------------------------------------------------------------
-v338 4/13/99 Add support for long option names.
-v339 4/18/99 Add \k, long option names to lesskey. Add -^P. Add :d.
-v340 4/21/99 Add regexec2. Fix Windows build.
- Posted to Web page.
+ 1/29/84 Allowed use on standard input
+ 2/1/84 Added E, N, P commands
+ 4/17/84 Added '=' command, 'stop' signal handling
+ 4/20/84 Added line folding
+v2 4/27/84 Fixed '=' command to use BOTTOM_PLUS_ONE,
+ instead of TOP, added 'p' & 'v' commands
+v3 5/3/84 Added -m and -t options, '-' command
+v4 5/3/84 Added LESS environment variable
+v5 5/3/84 New comments, fixed '-' command slightly
+v6 5/15/84 Added -Q, visual bell
+v7 5/24/84 Fixed jump_back(n) bug: n should count real
+ lines, not folded lines. Also allow number on G command.
+v8 5/30/84 Re-do -q and -Q commands
+v9 9/25/84 Added "+<cmd>" argument
+v10 10/10/84 Fixed bug in -b<n> argument processing
+v11 10/18/84 Made error() ring bell if \n not entered.
+-----------------------------------------------------------------
+v12 2/13/85 Reorganized signal handling and made portable to 4.2bsd.
+v13 2/16/85 Reword error message for '-' command.
+v14 2/22/85 Added -bf and -bp variants of -b.
+v15 2/25/85 Miscellaneous changes.
+v16 3/13/85 Added -u flag for backspace processing.
+v17 4/13/85 Added j and k commands, changed -t default.
+v18 4/20/85 Rewrote signal handling code.
+v19 5/2/85 Got rid of "verbose" eq_message().
+ Made search() scroll in some cases.
+v20 5/21/85 Fixed screen.c ioctls for System V.
+v21 5/23/85 Fixed some first_cmd bugs.
+v22 5/24/85 Added support for no RECOMP nor REGCMP.
+v23 5/25/85 Miscellanous changes and prettying up.
+ Posted to USENET.
+-----------------------------------------------------------------
+v24 6/3/85 Added ti,te terminal init & de-init.
+ (Thanks to Mike Kersenbrock)
+v25 6/8/85 Added -U flag, standout mode underlining.
+v26 6/9/85 Added -M flag.
+ Use underline termcap (us) if it exists.
+v27 6/15/85 Renamed some variables to make unique in
+ 6 chars. Minor fix to -m.
+v28 6/28/85 Fixed right margin bug.
+v29 6/28/85 Incorporated M.Rose's changes to signal.c
+v30 6/29/85 Fixed stupid bug in argument processing.
+v31 7/15/85 Added -p flag, changed repaint algorithm.
+ Added kludge for magic cookie terminals.
+v32 7/16/85 Added cat_file if output not a tty.
+v33 7/23/85 Added -e flag and EDITOR.
+v34 7/26/85 Added -s flag.
+v35 7/27/85 Rewrote option handling; added option.c.
+v36 7/29/85 Fixed -e flag to work if not last file.
+v37 8/10/85 Added -x flag.
+v38 8/19/85 Changed prompting; created prompt.c.
+v39 8/24/85 (Not -p) does not initially clear screen.
+v40 8/26/85 Added "skipping" indicator in forw().
+ Posted to USENET.
+-----------------------------------------------------------------
+v41 9/17/85 ONLY_RETURN, control char commands,
+ faster search, other minor fixes.
+v42 9/25/85 Added ++ command line syntax;
+ ch_fsize for pipes.
+v43 10/15/85 Added -h flag, changed prim.c algorithms.
+v44 10/16/85 Made END print in all cases of eof;
+ ignore SIGTTOU after receiv ing SIGTSTP.
+v45 10/16/85 Never print backspaces unless -u.
+v46 10/24/85 Backwards scroll in jump_loc.
+v47 10/30/85 Fixed bug in edit(): *first_cmd==0
+v48 11/16/85 Use TIOCSETN instead of TIOCSETP.
+ Added marks (m and ' commands).
+ Posted to USENET.
+-----------------------------------------------------------------
+v49 1/9/86 Fixed bug: signal didn't clear mcc.
+v50 1/15/86 Added ' (quote) to gomark.
+v51 1/16/86 Added + cmd, fixed problem if first_cmd
+ fails, made g cmd sort of "work" on pipes
+ ev en if bof is no longer buffered.
+v52 1/17/86 Made short files work better.
+v53 1/20/86 Added -P option.
+v54 1/20/86 Changed help to use HELPFILE.
+v55 1/23/86 Messages work better if not tty output.
+v56 1/24/86 Added -l option.
+v57 1/31/86 Fixed -l to get confirmation before
+ ov erwriting an existing file.
+v58 8/28/86 Added filename globbing.
+v59 9/15/86 Fixed some bugs with very long filenames.
+v60 9/26/86 Incorporated changes from Leith (Casey)
+ Leedom for boldface and -z option.
+v61 9/26/86 Got rid of annoying repaints after ! cmd.
+ Posted to USENET.
+-----------------------------------------------------------------
+v62 12/23/86 Added is_directory(); change -z default to
+ -1 instead of 24; cat-and-exit if -e and
+ file is less than a screenful.
+v63 1/8/87 Fixed bug in cat-and-exit if > 1 file.
+v64 1/12/87 Changed puts/putstr, putc/putchr,
+ getc/getchr to av oid name conflict with
+ stdio functions.
+v65 1/26/87 Allowed '-' command to change NUMBER
+ v alued options (thanks to Gary Puckering)
+v66 2/13/87 Fixed bug: prepaint should use force=1.
+v67 2/24/87 Added !! and % expansion to ! command.
+v68 2/25/87 Added SIGWINCH and TIOCGWINSZ support;
+ changed is_directory to bad_file.
+ (thanks to J. Robert Ward)
+v69 2/25/87 Added SIGWIND and WIOCGETD (for Unix PC).
+v70 3/13/87 Changed help cmd from 'h' to 'H'; better
+ error msgs in bad_file, errno_message.
+v71 5/11/87 Changed -p to -c, made triple -c/-C
+ for clear-eol like more's -c.
+v72 6/26/87 Added -E, -L, use $SHELL in lsystem().
+ (thanks to Stev e Spearman)
+v73 6/26/87 Allow Examine "#" for previous file.
+ Posted to USENET 8/25/87.
+-----------------------------------------------------------------
+v74 9/18/87 Fix conflict in EOF symbol with stdio.h,
+ Make os.c more portable to BSD.
+v75 9/23/87 Fix problems in get_term (thanks to
+ Paul Eggert); new backwards scrolling in
+ jump_loc (thanks to Marion Hakanson).
+v76 9/23/87 Added -i flag; allow single "!" to
+ inv oke a shell (thanks to Franco Barber).
+v77 9/24/87 Added -n flag and line number support.
+v78 9/25/87 Fixed problem with prompts longer than
+ the screen width.
+v79 9/29/87 Added the _ command.
+v80 10/6/87 Allow signal to break out of linenum scan.
+v81 10/6/87 Allow -b to be changed from within less.
+v82 10/7/87 Add cmd_decode to use a table for key
+ binding (thanks to Dav id Nason).
+v83 10/9/87 Allow .less file for user-defined keys.
+v84 10/11/87 Fix -e/-E problems (thanks to Felix Lee).
+v85 10/15/87 Search now keeps track of line numbers.
+v86 10/20/87 Added -B option and autobuf; fixed
+ "pipe error" bug.
+v87 3/1/88 Fix bug re BSD signals while reading file.
+v88 3/12/88 Use new format for -P option (thanks to
+ der Mouse), allow "+-c" without message,
+ fix bug re BSD hangup.
+v89 3/18/88 Turn off line numbers if linenum scan
+ is interrupted.
+v90 3/30/88 Allow -P from within less.
+v91 3/30/88 Added tags file support (new -t option)
+ (thanks to Brian Campbell).
+v92 4/4/88 Added -+option syntax.
+v93 4/11/88 Add support for slow input (thanks to
+ Joe Orost & apologies for taking almost
+ 3 years to get this in!)
+v94 4/11/88 Redo reading/signal stuff.
+v95 4/20/88 Repaint screen better after signal.
+v96 4/21/88 Add /! and ?! commands.
+v97 5/17/88 Allow -l/-L from within less.
+ Eliminate some static arrays (use calloc).
+ Posted to USENET.
+-----------------------------------------------------------------
+v98 10/14/88 Fix incorrect calloc call; uninitialized
+ var in exec_mca; core dump on unknown TERM.
+ Make v cmd work if past last line of file.
+ Fix some signal bugs.
+v99 10/29/88 Allow space between -X and string,
+ when X is a string-valued option.
+v100 1/5/89 Fix globbing bug when $SHELL not set;
+ allow spaces after -t command.
+v101 1/6/89 Fix problem with long (truncated) lines
+ in tags file (thanks to Neil Dixon).
+v102 1/6/89 Fix bug with E# when no prev file;
+ allow spaces after -l command.
+v103 3/14/89 Add -N, -f and -? options. Add z and w
+ commands. Add %L for prompt strings.
+v104 3/16/89 Added EDITPROTO.
+v105 3/20/89 Fix bug in find_linenum which cached
+ incorrectly on long lines.
+v106 3/31/89 Added -k option and multiple lesskey
+ files.
+v107 4/27/89 Add 8-bit char support and -g option.
+ Split option code into 3 files.
+v108 5/5/89 Allocate position table dynamically
+ (thanks to Paul Eggert); change % command
+ from "percent" to vi-style brace finder.
+v109 5/10/89 Added ESC-% command, split prim.c.
+v110 5/24/89 Fixed bug in + option; fixed repaint bug
+ under Sun windows (thanks to Paul Eggert).
+v111 5/25/89 Generalized # and % expansion; use
+ calloc for some error messages.
+v112 5/30/89 Get rid of ESC-%, add {}()[] commands.
+v113 5/31/89 Optimize lseeks (thanks to Paul Eggert).
+v114 7/25/89 Added ESC-/ and ESC-/! commands.
+v115 7/26/89 Added ESC-n command.
+v116 7/31/89 Added find_pos to optimize g command.
+v117 8/1/89 Change -f option to -r.
+v118 8/2/89 Save positions for all previous files,
+ not just the immediately previous one.
+v119 8/7/89 Save marks across file boundaries.
+ Add file handle stuff.
+v120 8/11/89 Add :ta command.
+v121 8/16/89 Add -f option.
+v122 8/30/89 Fix performance with many buffers.
+v123 8/31/89 Verbose prompts for string options.
+ Posted beta to USENET.
+-----------------------------------------------------------------
+v124 9/18/89 Reorganize search commands,
+ N = rev, ESC-n = span, add ESC-N.
+v125 9/18/89 Fix tab bug (thanks to Alex Liu).
+ Fix EOF bug when both -w and -c.
+v126 10/25/89 Add -j option.
+v127 10/27/89 Fix problems with blank lines before BOF.
+v128 10/27/89 Add %bj, etc. to prompt strings.
+v129 11/3/89 Add -+,-- commands; add set-option and
+ unset-option to lesskey.
+v130 11/6/89 Generalize A_EXTRA to string, remove
+ set-option, unset-option from lesskey.
+v131 11/7/89 Changed name of EDITPROTO to LESSEDIT.
+v132 11/8/89 Allow editing of command prefix.
+v133 11/16/89 Add -y option (thanks to Jeff Sullivan).
+v134 12/1/89 Glob filenames in the -l command.
+v135 12/5/89 Combined {}()[] commands into one, and
+ added ESC-^F and ESC-^B commands.
+v136 1/20/90 Added -S, -R flags. Added | command.
+ Added warning for binary files. (thanks
+ to Richard Brittain and J. Sullivan).
+v137 1/21/90 Rewrote horrible pappend code.
+ Added * notation for hi-bit chars.
+v138 1/24/90 Fix magic cookie terminal handling.
+ Get rid of "cleanup" loop in ch_get.
+v139 1/27/90 Added MSDOS support. (many thanks
+ to Richard Brittain).
+v140 2/7/90 Editing a new file adds it to the
+ command line list.
+v141 2/8/90 Add edit_list for editing >1 file.
+v142 2/10/90 Add :x command.
+v143 2/11/90 Add * and @ modifies to search cmds.
+ Change ESC-/ cmd from /@* to / *.
+v144 3/1/90 Messed around with ch_zero;
+ no real change.
+v145 3/2/90 Added -R and -v/-V for MSDOS;
+ renamed FILENAME to avoid conflict.
+v146 3/5/90 Pull cmdbuf functions out of command.c
+v147 3/7/90 Implement ?@; fix multi-file edit bugs.
+v148 3/29/90 Fixed bug in :e<file> then :e#.
+v149 4/3/90 Change error,ierror,query to use PARG.
+v150 4/6/90 Add LESS_CHARSET, LESS_CHARDEF.
+v151 4/13/90 Remove -g option; clean up ispipe.
+v152 4/14/90 lsystem() closes input file, for
+ editors which require exclusive open.
+v153 4/18/90 Fix bug if SHELL unset;
+ fix bug in overstrike control char.
+v154 4/25/90 Output to fd 2 via buffer.
+v155 4/30/90 Ignore -i if uppercase in pattern
+ (thanks to Michael Rendell.)
+v156 5/3/90 Remove scroll limits in forw() & back();
+ causes problems with -c.
+v157 5/4/90 Forward search starts at next real line
+ (not screen line) after jump target.
+v158 6/14/90 Added F command.
+v159 7/29/90 Fix bug in exiting: output not flushed.
+v160 7/29/90 Clear screen before initial output w/ -c.
+v161 7/29/90 Add -T flag.
+v162 8/14/90 Fix bug with +F on command line.
+v163 8/21/90 Added LESSBINFMT variable.
+v164 9/5/90 Added -p, LINES, COLUMNS and
+ unset mark ' == BOF, for 1003.2 D5.
+v165 9/6/90 At EOF with -c set, don't display empty
+ screen when try to page forward.
+v166 9/6/90 Fix G when final line in file wraps.
+v167 9/11/90 Translate CR/LF -> LF for 1003.2.
+v168 9/13/90 Return to curr file if "tag not found".
+v169 12/12/90 G goes to EOF even if file has grown.
+v170 1/17/91 Add optimization for BSD _setjmp;
+ fix #include ioctl.h TERMIO problem.
+ (thanks to Paul Eggert)
+ Posted to USENET.
+-----------------------------------------------------------------
+v171 3/6/91 Fix -? bug in get_filename.
+v172 3/15/91 Fix G bug in empty file.
+ Fix bug with ?\n and -i and uppercase
+ pattern at EOF!
+ (thanks to Paul Eggert)
+v173 3/17/91 Change N cmd to not permanently change
+ direction. (thanks to Brian Matthews)
+v174 3/18/91 Fix bug with namelogfile not getting
+ cleared when change files.
+v175 3/18/91 Fix bug with ++cmd on command line.
+ (thanks to Jim Meyering)
+v176 4/2/91 Change | to not force current screen,
+ include marked line, start/end from
+ top of screen. Improve search speed.
+ (thanks to Don Mears)
+v177 4/2/91 Add LESSHELP variable.
+ Fix bug with F command with -e.
+ Try /dev/tty for input before using fd 2.
+ Patches posted to USENET 4/2/91.
+-----------------------------------------------------------------
+v178 4/8/91 Fixed bug in globbing logfile name.
+ (thanks to Jim Meyering)
+v179 4/9/91 Allow negative -z for screen-relative.
+v180 4/9/91 Clear to eos rather than eol if "db";
+ don't use "sr" if "da".
+ (thanks to Tor Lillqvist)
+v181 4/18/91 Fixed bug with "negative" chars 80 - FF.
+ (thanks to Benny Sander Hofmann)
+v182 5/16/91 Fixed bug with attribute at EOL.
+ (thanks to Brian Matthews)
+v183 6/1/91 Rewrite linstall to do smart config.
+v184 7/11/91 Process \b in searches based on -u
+ rather than -i.
+v185 7/11/91 -Pxxx sets short prompt; assume SIGWINCH
+ after a SIGSTOP. (thanks to Ken Laprade)
+-----------------------------------------------------------------
+v186 4/20/92 Port to MS-DOS (Microsoft C).
+v187 4/23/92 Added -D option & TAB_COMPLETE_FILENAME.
+v188 4/28/92 Added command line editing features.
+v189 12/8/92 Fix mem overrun in anscreen.c:init;
+ fix edit_list to recover from bin file.
+v190 2/13/93 Make TAB enter one filename at a time;
+ create ^L with old TAB functionality.
+v191 3/10/93 Defer creating "flash" page for MS-DOS.
+v192 9/6/93 Add BACK-TAB.
+v193 9/17/93 Simplify binary_file handling.
+v194 1/4/94 Add rudiments of alt_filename handling.
+v195 1/11/94 Port back to Unix; support keypad.
+-----------------------------------------------------------------
+v196 6/7/94 Fix bug with bad filename; fix IFILE
+ type problem. (thanks to David MacKenzie)
+v197 6/7/94 Fix bug with .less tables inserted wrong.
+v198 6/23/94 Use autoconf installation technology.
+ (thanks to David MacKenzie)
+v199 6/29/94 Fix MS-DOS build (thanks to Tim Wiegman).
+v200 7/25/94 Clean up copyright, minor fixes.
+ Posted to prep.ai.mit.edu
+-----------------------------------------------------------------
+v201 7/27/94 Check for no memcpy; add casts to calloc;
+ look for regcmp in libgen.a.
+ (thanks to Kaveh Ghazi).
+v202 7/28/94 Fix bug in edit_next/edit_prev with
+ non-existant files.
+v203 8/2/94 Fix a variety of configuration bugs on
+ various systems. (thanks to Sakai
+ Kiyotaka, Harald Koenig, Bjorn Brox,
+ Teemu Rantanen, and Thorsten Lockert)
+v204 8/3/94 Use strerror if available.
+ (thanks to J.T. Conklin)
+v205 8/5/94 Fix bug in finding "me" termcap entry.
+ (thanks to Andreas Stolcke)
+8/10/94 v205+: Change BUFSIZ to LBUFSIZE to avoid name
+ conflict with stdio.h.
+ Posted to prep.ai.mit.edu
+-----------------------------------------------------------------
+v206 8/10/94 Use initial_scrpos for -t to avoid
+ displaying first page before init().
+ (thanks to Dominique Petitpierre)
+v207 8/12/94 Fix bug if stdout is not tty.
+v208 8/16/94 Fix bug in close_altfile if goto err1
+ in edit_ifile. (Thanks to M.J. Hewitt)
+v209 8/16/94 Change scroll to wscroll to avoid
+ conflict with library function.
+v210 8/16/94 Fix bug with bold on 8 bit chars.
+ (thanks to Vitor Duarte)
+v211 8/16/94 Don't quit on EOI in jump_loc / forw.
+v212 8/18/94 Use time_t if available.
+v213 8/20/94 Allow ospeed to be defined in termcap.h.
+v214 8/20/94 Added HILITE_SEARCH, -F, ESC-u cmd.
+ (thanks to Paul Lew and Bob Byrnes)
+v215 8/23/94 Fix -i toggle behavior.
+v216 8/23/94 Process BS in all searches, not only -u.
+v217 8/24/94 Added -X flag.
+v218 8/24/94 Reimplement undo_search.
+v219 8/24/94 Find tags marked with line number
+ instead of pattern.
+v220 8/24/94 Stay at same position after SIG_WINCH.
+v221 8/24/94 Fix bug in file percentage in big file.
+v222 8/25/94 Do better if can't reopen current file.
+v223 8/27/94 Support setlocale.
+ (thanks to Robert Joop)
+v224 8/29/94 Revert v216: process BS in search
+ only if -u.
+v225 9/6/94 Rewrite undo_search again: toggle.
+v226 9/15/94 Configuration fixes.
+ (thanks to David MacKenzie)
+v227 9/19/94 Fixed strerror config problem.
+ Posted to prep.ai.mit.edu
+-----------------------------------------------------------------
+v228 9/21/94 Fix bug in signals: repeated calls to
+ get_editkeys overflowed st_edittable.
+v229 9/21/94 Fix "Nothing to search" error if -a
+ and SRCH_PAST_EOF.
+v230 9/21/94 Don't print extra error msg in search
+ after regerror().
+v231 9/22/94 Fix hilite bug if search matches 0 chars.
+ (thanks to John Polstra)
+v232 9/23/94 Deal with weird systems that have
+ termios.h but not tcgetattr().
+ Posted to prep.ai.mit.edu
+-----------------------------------------------------------------
+v233 9/26/94 Use get_term() instead of pos_init() in
+ psignals to re-get lower_left termcap.
+ (Thanks to John Malecki)
+v234 9/26/94 Make MIDDLE closer to middle of screen.
+v235 9/27/94 Use local strchr if system doesn't have.
+v236 9/28/94 Don't use libucb; use libterm if
+ libtermcap & libcurses doesn't work.
+ (Fix for Solaris; thanks to Frank Kaefer)
+v237 9/30/94 Use system isupper() etc if provided.
+ Posted to prep.ai.mit.edu
+-----------------------------------------------------------------
+v238 10/6/94 Make binary non-blinking if LESSBINFMT
+ is set to a string without a *.
+v239 10/7/94 Don't let delimit_word run back past
+ beginning of cmdbuf.
+v240 10/10/94 Don't write into termcap buffer.
+ (Thanks to Benoit Speckel)
+v241 10/13/94 New lesskey file format.
+ Don't expand filenames in search command.
+v242 10/14/94 Allow lesskey specification of "literal".
+v243 10/14/94 Add #stop command to lesskey.
+v244 10/16/94 Add -f flag to lesskey.
+v245 10/25/94 Allow TAB_COMPLETE_FILENAME to be undefd.
+v246 10/27/94 Move help file to /usr/local/share.
+v247 10/27/94 Add -V option.
+v248 11/5/94 Add -V option to lesskey.
+v249 11/5/94 Remove -f flag from lesskey; default
+ input file is ~/.lesskey.in, not stdin.
+v250 11/7/94 Lesskey input file "-" means stdin.
+v251 11/9/94 Convert cfgetospeed result to ospeed.
+ (Thanks to Andrew Chernov)
+v252 11/16/94 Change default lesskey input file from
+ .lesskey.in to .lesskey.
+ Posted to prep.ai.mit.edu
+-----------------------------------------------------------------
+v253 11/21/94 Fix bug when tags file has a backslash.
+v254 12/6/94 Fix -k option.
+v255 12/8/94 Add #define EXAMINE to disable :e etc.
+v256 12/10/94 Change highlighting: only highlite search
+ results (but now it is reliable).
+v257 12/10/94 Add goto_line and repaint_highlight
+ to optimize highlight repaints.
+v258 12/12/94 Fixup in hilite_line if BS_SPECIAL.
+v259 12/12/94 Convert to autoconf 2.0.
+v260 12/13/94 Add SECURE define.
+v261 12/14/94 Use system WERASE char as EC_W_BACKSPACE.
+v262 12/16/94 Add -g/-G flag and screen_hilite.
+v263 12/20/94 Reimplement/optimize -G flag behavior.
+v264 12/23/94 Allow EXTRA string after line-edit cmd
+ in lesskey file.
+v265 12/24/94 Add LESSOPEN=|cmd syntax.
+v266 12/26/94 Add -I flag.
+v267 12/28/94 Formalize the four-byte header emitted
+ by a LESSOPEN pipe.
+v268 12/28/94 Get rid of four-byte header.
+v269 1/2/95 Close alt file before open new one.
+ Avoids multiple popen().
+v270 1/3/95 Use VISUAL; use S_ISDIR/S_ISREG; fix
+ config problem with Solaris POSIX regcomp.
+v271 1/4/95 Don't quit on read error.
+v272 1/5/95 Get rid of -L.
+v273 1/6/95 Fix ch_ungetchar bug; don't call
+ LESSOPEN on a pipe.
+v274 1/6/95 Ported to OS/2 (thanks to Kai Uwe Rommel)
+v275 1/18/95 Fix bug if toggle -G at EOF.
+v276 1/30/95 Fix OS/2 version.
+v277 1/31/95 Add "next" charset; don't display ^X
+ for X > 128.
+v278 2/14/95 Change default for -G.
+ Posted to prep.ai.mit.edu
+-----------------------------------------------------------------
+v279 2/22/95 Add GNU options --help, --version.
+ Minor config fixes.
+v280 2/24/95 Clean up calls to glob(); don't set #
+ if we can't open the new file.
+v281 2/24/95 Repeat search should turn on hilites.
+v282 3/2/95 Minor fixes.
+v283 3/2/95 Fix homefile; make OS2 look in $HOME.
+v284 3/2/95 Error if "v" on LESSOPENed file;
+ "%" figures out file size on pipe.
+v285 3/7/95 Don't set # in lsystem;
+ lesskey try $HOME first.
+v286 3/7/95 Reformat change history (too much free time?).
+v287 3/8/95 Fix hilite bug if overstrike multiple chars.
+v288 3/8/95 Allow lesskey to override get_editkey keys.
+v289 3/9/95 Fix adj_hilite bug when line gets processed by
+ hilite_line more than once.
+v290 3/9/95 Make configure automatically. Fix Sequent problem
+ with incompatible sigsetmask().
+ Posted to prep.ai.mit.edu
+-----------------------------------------------------------------
+v291 3/21/95 Add #env to lesskey. Fix MS-DOS build.
+ Posted to simtel.
+-----------------------------------------------------------------
+v292 4/24/95 Add MS-DOS support for Borland C.
+ Fix arrow keys in MS-DOS versions.
+v293 4/28/95 Add auto-versioning stuff to make dist.
+v294 5/12/95 Fix Borland build.
+v295 1/20/96 Fix search on squished file; add /@@.
+v296 1/23/96 Allow cmdbuf larger than screen width.
+v297 1/24/96 Don't call termcap if tgetent fails;
+ add #defines for buffers.
+v298 1/24/96 Change @@ to ^K.
+ Add alternate search modifiers ^N, ^F, ^E.
+v299 1/25/96 Fix percent overflow in jump_percent (thanks to Brent Wiese);
+ don't send "ti" after shell command till RETURN pressed.
+v300 1/25/96 Change -U to print tabs as ^I.
+v301 1/30/96 Make hilites work in cmd F output.
+v302 1/31/96 Fix cmd F to notice window-change signals.
+v303 1/31/96 Add ESC-SPACE command.
+v304 2/1/96 Add ^R search modifier; add LESSSECURE.
+v305 2/2/96 Workaround Linux /proc kernel bug; add LESSKEY.
+v306 3/16/96 Minor fixes.
+v307 3/25/96 Allow cmd line arg "--"; fix DOS & OS/2 defines.h.
+v308 4/4/96 Port to OS-9 (thanks to Boisy Pitre); fix -d.
+v309 4/9/96 Fix OS-9 version; fix tags bug with "$".
+v310 4/10/96 Get rid of HELPFILE.
+v311 4/22/96 Add Windows32 support; merge doscreen.c into screen.c.
+v312 4/24/96 Don't quit after "cannot reopen" error.
+v313 4/25/96 Added horizontal scrolling.
+v314 4/26/96 Modified -e to quit on reaching end of a squished file.
+v315 4/26/96 Fix "!;TAB" bug.
+v316 5/2/96 Make "|a" when (a < curr screen) go to end of curr screen.
+v317 5/14/96 Various fixes for the MS-DOS and OS/2 builds.
+ Added ## and %% handling for filenames
+v318 5/29/96 Port to OS-9 Microware compiler; minor fixes
+ (thanks to Martin Gregorie).
+v319 7/8/96 Fix Windows port (thanks to Jeff Paquette).
+v320 7/11/96 Final fixes for Windows port.
+v321 7/18/96 Minor fixes.
+ Posted to Web page.
+-----------------------------------------------------------------
+v322 8/13/96 Fix bug in shell escape from help file; add support for
+ Microsoft Visual C under Windows; numerous small fixes.
+v323 8/19/96 Fixes for Windows version (thanks to Simon Munton);
+ fix for Linux library weirdness (thanks to Jim Diamond);
+ port to DJGPP (thanks to Eli Zaretskii).
+v324 8/21/96 Add support for spaces in filenames (thanks to Simon Munton).
+v325 8/21/96 Add lessecho, for spaces in filenames under Unix.
+v326 8/27/96 Fix DJGPP version.
+v327 9/1/96 Reorganize lglob, make spaces in filenames work better in Unix.
+v328 10/7/96 Append / to directory name in filename completion.
+ Fix MS-DOS and OS-9 versions.
+v329 10/11/96 Fix more MS-DOS bugs; add LESSSEPARATOR; add -" option.
+ Add LESSMETACHARS, LESSMETAESCAPE.
+v330 10/21/96 Minor fixes.
+ Posted to Web page.
+-----------------------------------------------------------------
+v331 4/22/97 Various Windows fixes (thanks to Gurusamy Sarathy).
+v332 4/22/97 Enter filenames from cmd line into edit history.
+ Posted to Web page.
+-----------------------------------------------------------------
+v333 3/4/99 Changed -w to highlite new line after forward movement.
+v334 3/9/99 Avoid overflowing prompt buffer; add %d and %D.
+v335 3/20/99 Add EBCDIC support (thanks to Thomas Dorner).
+ Use HOMEDRIVE/HOMEPATH on Windows (thanks to Preston Bannister).
+ Posted to Web page.
+-----------------------------------------------------------------
+v336 4/8/99 Fix installation bugs.
+v337 4/9/99 Fix another installation bug.
+ Posted to Web page.
+-----------------------------------------------------------------
+v338 4/13/99 Add support for long option names.
+v339 4/18/99 Add \k, long option names to lesskey. Add -^P. Add :d.
+v340 4/21/99 Add regexec2. Fix Windows build.
+ Posted to Web page.
-----------------------------------------------------------------
v341 5/6/99 Add -F option; %c & ?c prompt escapes.
- (Thanks to Michele Maltoni)
+ (Thanks to Michele Maltoni)
v342 7/22/99 Add system-wide lesskey file; allow GPL or Less License.
-v343 9/23/99 Support UTF-8 (Thanks to Robert Brady).
- Add %P and ?P in prompts.
-v344 10/27/99 -w highlights target line of g and p commands.
-v345 10/29/99 Make -R pass thru ESC but not other control chars.
- Posted to Web page.
+v343 9/23/99 Support UTF-8 (Thanks to Robert Brady).
+ Add %P and ?P in prompts.
+v344 10/27/99 -w highlights target line of g and p commands.
+v345 10/29/99 Make -R pass thru ESC but not other control chars.
+ Posted to Web page.
-----------------------------------------------------------------
v346 11/4/99 Fix bugs in long option processing; R cmd should clear hilites.
- Posted to Web page.
------------------------------------------------------------------
-v347 12/13/99 Fixes for DJGPP version (thanks to Eli Zaretskii).
-v348 12/28/99 Fix deleting file with marks (thanks to Dimitar Jekov).
- Fix color problem in DJGPP version (thanks to Eli Zaretskii).
-v349 1/24/00 Fix minor DJGPP bugs; check environment vars for UTF-8;
- add --with-editor (thanks to Eli, Markus Kuhn, Thomas Schoepf).
-v350 3/1/00 Fix clear-while-standout bug.
-v351 3/5/00 Change -M and = prompts to show top & bottom line number.
- Posted to Web page.
------------------------------------------------------------------
-v352 3/8/00 Fix scan_option NULL dereference.
------------------------------------------------------------------
-v353 3/20/00 Fix SECURE compile bug, allow space after numeric option.
-v354 3/23/00 Add support for PCRE; add --with-regex configure option.
------------------------------------------------------------------
-v355 6/28/00 Add -# option (thanks to Andy Levinson).
-v356 7/5/00 Add -J option.
-v357 7/6/00 Support sigprocmask.
------------------------------------------------------------------
-v358 7/8/00 Fix problems with #stop in lesskey file.
- Posted to Web page.
------------------------------------------------------------------
-v359 9/10/00 Fixes for Win32 display problems (thanks to Maurizio Vairani).
-v360 1/17/01 Move sysless to etc.
-v361 12/4/01 Add IBM-1047 charset & EBCDIC fixes (thanks to Thomas Dorner).
- Fix 32 bit dependencies (thanks to Paul Eggert).
- Fix UTF-8 overstriking (thanks to Robert Brady).
-v362 12/4/01 Make status column show search targets.
-v363 12/6/01 Add --no-keypad option.
- Add variable width tabstops (thanks to Peter Samuelson).
-v364 12/10/01 Better handling of very long lines in input;
- Fix horizontal shifting of colored text.
-v365 12/11/01 Fix overstriking of tabs;
- Add support for global(1) and multiple tag matches
- (thanks to Shigio Yamaguchi and Tim Vanderhoek).
-v366 12/11/01 Fixes for OS/2 (thanks to Kyosuke Tokoro).
-v367 12/13/01 Allow -D and -x options to terminate without dollar sign;
- Right/left arrow when entering N are shift cmds, not line edit.
-v368 12/18/01 Update lesskey commands.
-v370 12/23/01 Fix tags error messages.
- Posted to Web page.
------------------------------------------------------------------
-v371 12/26/01 Fix new_file bug; use popen in Windows version;
- fix some compiler warnings.
-v372 12/29/01 Make -b be in units of 1K.
-v373 1/14/02 Improve handling of filenames containing shell metachars.
-v374 2/7/02 Fix memory leak; fix bug in -x argument parsing.
-v375 4/7/02 Fix searching for SGR sequences; fix SECURE build;
- add SGR support to DJGPP version (thanks to Eli Zaretskii).
-v376 6/10/02 Fix bug in overstriking mulitbyte UTF-8 characters
- (thanks to Jungshik Shin).
- Posted to Web page.
------------------------------------------------------------------
-v377 9/10/02 Fix bug in Windows version when file contains CR;
- fix bug in search highlights with -R;
- make initial buffer limit really be 64K not unlimited.
-v378 9/30/02 Misc bug fixes and compiler warning cleanup.
- Posted to Web page.
------------------------------------------------------------------
-v379 11/23/02 Add -L option; fix bug with ctrl-K in lesskey files;
- improve UTF-8 overstriking and underscore overstriking;
- fix minor man page problems; change to autoconf 2.54.
-v380 11/24/02 Make LINENUM same as POSITION.
-v381 11/28/02 Make -N use 7 columns for line number if possible.
------------------------------------------------------------------
-v382 2/3/04 Remove copyrighted code.
------------------------------------------------------------------
-v383 2/16/04 Add history file; add -K option; improve UTF-8 handling;
- fix some signed char bugs (thanks to Christian Biere);
- fix some upper/lower case bugs (thanks to Bjoern Jacke);
- add erase2 char (thanks to David Lawrence);
- add windows charset (thanks to Dimitar Zhekov).
-v384 2/20/04 Improvements in UTF-8 handling.
-v385 2/23/04 Fix UTF-8 output bug.
------------------------------------------------------------------
-v386 9/13/05 Improvements to UTF-8 shift & color (thanks to Charles Levert);
- protect against invalid LESSOPEN and LESSCLOSE values.
-v387 9/14/05 Update Charles Levert's UTF-8 patch.
-v388 9/14/05 Change history behavior; change most sprintf calls to snprintf.
-v389 9/14/05 Fix copy & paste with long lines; improve performance of
- expand_linebuf; fix crash in init_mlist;
-v390 9/15/05 Show search matches in status column even if -G is set.
------------------------------------------------------------------
-v391 9/17/05 Fix bugs.
-v392 10/14/05 Fix line wrapping bug.
-v393 10/19/05 Allow multiple attributes per char; fix bold+underline bug
- (thanks again to Charles Levert).
-v394 11/8/05 Fix prompt bug; fix compile problem in Windows build.
------------------------------------------------------------------
-v395 1/12/07 Update Unicode tables (thanks to Charles Levert);
- don't chmod if LESSHISTFILE = /dev/null;
- make -f work for directories; support DESTDIR in Makefile;
- fix sigset_t detection in configure;
- make "t" cmd traverse tags in correct order
-v396 1/13/07 Add compatibility with POSIX more.
-v397 3/21/07 Allow decimal point in number for % command;
- Allow decimal point in number for -j option;
- Allow n command to fetch last search pattern from history
- (thanks to arno).
-v398 3/22/07 Don't rewrite history file if not necessary;
- fix bug when filenames contain "$".
-v399 3/22/07 Don't move to bottom of screen at startup;
- don't output extraneous newlines.
-v400 3/23/07 Allow search to find pattern after null byte (PCRE and no-regex)
- (thanks to Michael Constant).
------------------------------------------------------------------
-v401 3/24/07 Minor documentation fixes.
-v402 3/30/07 Fix autoconf bug when memcpy etc are inline;
- fix bug in terminating number following -j option.
-v403 5/25/07 Fix Windows build.
-v404 6/5/07 Fix display bug with F command and long lines.
-v405 6/17/07 Fix display bug when using -w option.
-v406 6/17/07 Fix secure build.
-v407 8/16/07 Fix bugs; support CSI chars.
-v408 10/1/07 Fix bug in -i with non-ASCII chars.
-v409 10/12/07 Fix crash when viewing text with invalid UTF-8 sequences.
-v411 11/6/07 Fix case-insensitive searching with non-ASCII text.
-v412 11/6/07 Use symbolic SEEK constants.
-v413 11/6/07 Fix search highlight bug with non-ASCII text.
-v414 11/6/07 Fix display bug with no-wrap terminals.
-v415 11/14/07 Add --follow-name option.
-v416 11/22/07 Fix crash when searching text with invalid UTF-8 sequences.
-v417 12/31/07 Don't support single-char CSI in UTF-8 mode;
- fix bug with -R and invalid CSI sequences;
- fix bug searching text with SGR sequences with -r;
- emulate SGR sequences in WIN32 build.
-v418 12/31/07 Clean up.
+ Posted to Web page.
+-----------------------------------------------------------------
+v347 12/13/99 Fixes for DJGPP version (thanks to Eli Zaretskii).
+v348 12/28/99 Fix deleting file with marks (thanks to Dimitar Jekov).
+ Fix color problem in DJGPP version (thanks to Eli Zaretskii).
+v349 1/24/00 Fix minor DJGPP bugs; check environment vars for UTF-8;
+ add --with-editor (thanks to Eli, Markus Kuhn, Thomas Schoepf).
+v350 3/1/00 Fix clear-while-standout bug.
+v351 3/5/00 Change -M and = prompts to show top & bottom line number.
+ Posted to Web page.
+-----------------------------------------------------------------
+v352 3/8/00 Fix scan_option NULL dereference.
+-----------------------------------------------------------------
+v353 3/20/00 Fix SECURE compile bug, allow space after numeric option.
+v354 3/23/00 Add support for PCRE; add --with-regex configure option.
+-----------------------------------------------------------------
+v355 6/28/00 Add -# option (thanks to Andy Levinson).
+v356 7/5/00 Add -J option.
+v357 7/6/00 Support sigprocmask.
+-----------------------------------------------------------------
+v358 7/8/00 Fix problems with #stop in lesskey file.
+ Posted to Web page.
+-----------------------------------------------------------------
+v359 9/10/00 Fixes for Win32 display problems (thanks to Maurizio Vairani).
+v360 1/17/01 Move sysless to etc.
+v361 12/4/01 Add IBM-1047 charset & EBCDIC fixes (thanks to Thomas Dorner).
+ Fix 32 bit dependencies (thanks to Paul Eggert).
+ Fix UTF-8 overstriking (thanks to Robert Brady).
+v362 12/4/01 Make status column show search targets.
+v363 12/6/01 Add --no-keypad option.
+ Add variable width tabstops (thanks to Peter Samuelson).
+v364 12/10/01 Better handling of very long lines in input;
+ Fix horizontal shifting of colored text.
+v365 12/11/01 Fix overstriking of tabs;
+ Add support for global(1) and multiple tag matches
+ (thanks to Shigio Yamaguchi and Tim Vanderhoek).
+v366 12/11/01 Fixes for OS/2 (thanks to Kyosuke Tokoro).
+v367 12/13/01 Allow -D and -x options to terminate without dollar sign;
+ Right/left arrow when entering N are shift cmds, not line edit.
+v368 12/18/01 Update lesskey commands.
+v370 12/23/01 Fix tags error messages.
+ Posted to Web page.
+-----------------------------------------------------------------
+v371 12/26/01 Fix new_file bug; use popen in Windows version;
+ fix some compiler warnings.
+v372 12/29/01 Make -b be in units of 1K.
+v373 1/14/02 Improve handling of filenames containing shell metachars.
+v374 2/7/02 Fix memory leak; fix bug in -x argument parsing.
+v375 4/7/02 Fix searching for SGR sequences; fix SECURE build;
+ add SGR support to DJGPP version (thanks to Eli Zaretskii).
+v376 6/10/02 Fix bug in overstriking mulitbyte UTF-8 characters
+ (thanks to Jungshik Shin).
+ Posted to Web page.
+-----------------------------------------------------------------
+v377 9/10/02 Fix bug in Windows version when file contains CR;
+ fix bug in search highlights with -R;
+ make initial buffer limit really be 64K not unlimited.
+v378 9/30/02 Misc bug fixes and compiler warning cleanup.
+ Posted to Web page.
+-----------------------------------------------------------------
+v379 11/23/02 Add -L option; fix bug with ctrl-K in lesskey files;
+ improve UTF-8 overstriking and underscore overstriking;
+ fix minor man page problems; change to autoconf 2.54.
+v380 11/24/02 Make LINENUM same as POSITION.
+v381 11/28/02 Make -N use 7 columns for line number if possible.
+-----------------------------------------------------------------
+v382 2/3/04 Remove copyrighted code.
+-----------------------------------------------------------------
+v383 2/16/04 Add history file; add -K option; improve UTF-8 handling;
+ fix some signed char bugs (thanks to Christian Biere);
+ fix some upper/lower case bugs (thanks to Bjoern Jacke);
+ add erase2 char (thanks to David Lawrence);
+ add windows charset (thanks to Dimitar Zhekov).
+v384 2/20/04 Improvements in UTF-8 handling.
+v385 2/23/04 Fix UTF-8 output bug.
+-----------------------------------------------------------------
+v386 9/13/05 Improvements to UTF-8 shift & color (thanks to Charles Levert);
+ protect against invalid LESSOPEN and LESSCLOSE values.
+v387 9/14/05 Update Charles Levert's UTF-8 patch.
+v388 9/14/05 Change history behavior; change most sprintf calls to snprintf.
+v389 9/14/05 Fix copy & paste with long lines; improve performance of
+ expand_linebuf; fix crash in init_mlist;
+v390 9/15/05 Show search matches in status column even if -G is set.
+-----------------------------------------------------------------
+v391 9/17/05 Fix bugs.
+v392 10/14/05 Fix line wrapping bug.
+v393 10/19/05 Allow multiple attributes per char; fix bold+underline bug
+ (thanks again to Charles Levert).
+v394 11/8/05 Fix prompt bug; fix compile problem in Windows build.
+-----------------------------------------------------------------
+v395 1/12/07 Update Unicode tables (thanks to Charles Levert);
+ don't chmod if LESSHISTFILE = /dev/null;
+ make -f work for directories; support DESTDIR in Makefile;
+ fix sigset_t detection in configure;
+ make "t" cmd traverse tags in correct order
+v396 1/13/07 Add compatibility with POSIX more.
+v397 3/21/07 Allow decimal point in number for % command;
+ Allow decimal point in number for -j option;
+ Allow n command to fetch last search pattern from history
+ (thanks to arno).
+v398 3/22/07 Don't rewrite history file if not necessary;
+ fix bug when filenames contain "$".
+v399 3/22/07 Don't move to bottom of screen at startup;
+ don't output extraneous newlines.
+v400 3/23/07 Allow search to find pattern after null byte (PCRE and no-regex)
+ (thanks to Michael Constant).
+-----------------------------------------------------------------
+v401 3/24/07 Minor documentation fixes.
+v402 3/30/07 Fix autoconf bug when memcpy etc are inline;
+ fix bug in terminating number following -j option.
+v403 5/25/07 Fix Windows build.
+v404 6/5/07 Fix display bug with F command and long lines.
+v405 6/17/07 Fix display bug when using -w option.
+v406 6/17/07 Fix secure build.
+v407 8/16/07 Fix bugs; support CSI chars.
+v408 10/1/07 Fix bug in -i with non-ASCII chars.
+v409 10/12/07 Fix crash when viewing text with invalid UTF-8 sequences.
+v411 11/6/07 Fix case-insensitive searching with non-ASCII text.
+v412 11/6/07 Use symbolic SEEK constants.
+v413 11/6/07 Fix search highlight bug with non-ASCII text.
+v414 11/6/07 Fix display bug with no-wrap terminals.
+v415 11/14/07 Add --follow-name option.
+v416 11/22/07 Fix crash when searching text with invalid UTF-8 sequences.
+v417 12/31/07 Don't support single-char CSI in UTF-8 mode;
+ fix bug with -R and invalid CSI sequences;
+ fix bug searching text with SGR sequences with -r;
+ emulate SGR sequences in WIN32 build.
+v418 12/31/07 Clean up.
+-----------------------------------------------------------------
+v419 1/16/08 Make CSI char 0x9B work in UTF-8 mode (thanks to Colin Watson).
+v420 2/24/08 Add & command; fix -F option; fix '' after G.
+v421 2/24/08 Ignore filtered lines when searching.
+v422 3/2/08 Output CR at startup.
+v423 5/27/08 Clean up.
+v424 6/16/08 Fix compile bug with pcre; don't filter help file.
+v425 7/14/08 Fix non-ANSI code in list handling in ch.c.
+v426 10/27/08 Fix ignaw terminal handling (thanks to Per Hedeland);
+ fix binary file detection in UTF-8 mode.
+v427 3/16/09 A few Win32 fixes (thanks to Jason Hood).
+v428 3/30/09 Add "|-" syntax to LESSOPEN.
+v429 4/10/09 Fix search highlighting bug with underlined text.
*/
-char version[] = "418";
+char version[] = "429";