summaryrefslogtreecommitdiffstats
path: root/contrib/less/forwback.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/forwback.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/forwback.c')
-rw-r--r--contrib/less/forwback.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/contrib/less/forwback.c b/contrib/less/forwback.c
index 0166266..9626dc1 100644
--- a/contrib/less/forwback.c
+++ b/contrib/less/forwback.c
@@ -1,6 +1,6 @@
/* $FreeBSD$ */
/*
- * 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.
@@ -21,6 +21,7 @@ public int screen_trashed;
public int squished;
public int no_back_scroll = 0;
public int forw_prompt;
+public int same_pos_bell = 1;
extern int sigs;
extern int top_scroll;
@@ -34,6 +35,11 @@ extern int ignore_eoi;
extern int clear_bg;
extern int final_attr;
extern int oldbot;
+#if HILITE_SEARCH
+extern int size_linebuf;
+extern int hilite_search;
+extern int status_col;
+#endif
#if TAGS
extern char *tagoption;
#endif
@@ -126,7 +132,6 @@ forw(n, pos, force, only_last, nblank)
int only_last;
int nblank;
{
- int eof = 0;
int nlines = 0;
int do_repaint;
static int first_time = 1;
@@ -145,6 +150,13 @@ forw(n, pos, force, only_last, nblank)
do_repaint = (only_last && n > sc_height-1) ||
(forw_scroll >= 0 && n > forw_scroll && n != sc_height-1);
+#if HILITE_SEARCH
+ if (hilite_search == OPT_ONPLUS || is_filtering() || status_col) {
+ prep_hilite(pos, pos + 4*size_linebuf, ignore_eoi ? 1 : -1);
+ pos = next_unfiltered(pos);
+ }
+#endif
+
if (!do_repaint)
{
if (top_scroll && n >= sc_height - 1 && pos != ch_length())
@@ -206,6 +218,9 @@ forw(n, pos, force, only_last, nblank)
* Get the next line from the file.
*/
pos = forw_line(pos);
+#if HILITE_SEARCH
+ pos = next_unfiltered(pos);
+#endif
if (pos == NULL_POSITION)
{
/*
@@ -214,7 +229,6 @@ forw(n, pos, force, only_last, nblank)
* Even if force is true, stop when the last
* line in the file reaches the top of screen.
*/
- eof = 1;
if (!force && position(TOP) != NULL_POSITION)
break;
if (!empty_lines(0, 0) &&
@@ -276,7 +290,7 @@ forw(n, pos, force, only_last, nblank)
forw_prompt = 1;
}
- if (nlines == 0)
+ if (nlines == 0 && same_pos_bell)
eof_bell();
else if (do_repaint)
repaint();
@@ -299,11 +313,20 @@ back(n, pos, force, only_last)
squish_check();
do_repaint = (n > get_back_scroll() || (only_last && n > sc_height-1));
+#if HILITE_SEARCH
+ if (hilite_search == OPT_ONPLUS || is_filtering() || status_col) {
+ prep_hilite((pos < 3*size_linebuf) ? 0 : pos - 3*size_linebuf, pos, -1);
+ }
+#endif
while (--n >= 0)
{
/*
* Get the previous line of input.
*/
+#if HILITE_SEARCH
+ pos = prev_unfiltered(pos);
+#endif
+
pos = back_line(pos);
if (pos == NULL_POSITION)
{
@@ -327,7 +350,7 @@ back(n, pos, force, only_last)
}
}
- if (nlines == 0)
+ if (nlines == 0 && same_pos_bell)
eof_bell();
else if (do_repaint)
repaint();
OpenPOWER on IntegriCloud