summaryrefslogtreecommitdiffstats
path: root/contrib/less/input.c
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2016-01-18 19:13:54 +0000
committerdelphij <delphij@FreeBSD.org>2016-01-18 19:13:54 +0000
commitfa1e90c82bb54806d86166769a4547bf68c3e727 (patch)
treefb469219be6a56d727e63953151fbca9a019057d /contrib/less/input.c
parent119cebf8a0b980468f7ed411c651dd92ff2a0a88 (diff)
downloadFreeBSD-src-fa1e90c82bb54806d86166769a4547bf68c3e727.zip
FreeBSD-src-fa1e90c82bb54806d86166769a4547bf68c3e727.tar.gz
MFC r293190: MFV r293125: less v481.
Relnotes: yes
Diffstat (limited to 'contrib/less/input.c')
-rw-r--r--contrib/less/input.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/contrib/less/input.c b/contrib/less/input.c
index b211323..9419a02 100644
--- a/contrib/less/input.c
+++ b/contrib/less/input.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1984-2012 Mark Nudelman
+ * Copyright (C) 1984-2015 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.
@@ -60,6 +60,7 @@ get_forw_line:
}
#if HILITE_SEARCH
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
@@ -69,6 +70,8 @@ get_forw_line:
*/
prep_hilite(curr_pos, curr_pos + 3*size_linebuf,
ignore_eoi ? 1 : -1);
+ curr_pos = next_unfiltered(curr_pos);
+ }
#endif
if (ch_seek(curr_pos))
{
@@ -439,19 +442,22 @@ set_attnpos(pos)
{
c = ch_forw_get();
if (c == EOI)
- return;
- if (c != '\n' && c != '\r')
break;
+ if (c == '\n' || c == '\r')
+ {
+ (void) ch_back_get();
+ break;
+ }
pos++;
}
+ end_attnpos = pos;
+ for (;;)
+ {
+ c = ch_back_get();
+ if (c == EOI || c == '\n' || c == '\r')
+ break;
+ pos--;
+ }
}
start_attnpos = pos;
- for (;;)
- {
- c = ch_forw_get();
- pos++;
- if (c == EOI || c == '\n' || c == '\r')
- break;
- }
- end_attnpos = pos;
}
OpenPOWER on IntegriCloud