aboutsummaryrefslogtreecommitdiff
path: root/contrib/less/input.c
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2021-04-19 02:46:19 +0000
committerXin LI <delphij@FreeBSD.org>2021-04-19 02:46:19 +0000
commit2235c7feac959bcc9ddfd6a2bc6be32102b1f84c (patch)
tree725c892a383c6f32d4cd96301ff44db5648a4c6a /contrib/less/input.c
parent8d9fefe64334818a27812658bf9efd0371fbc77c (diff)
parent1737d9dd586fd32916293643b7b06c088f8c22e7 (diff)
downloadsrc-2235c7feac959bcc9ddfd6a2bc6be32102b1f84c.tar.gz
src-2235c7feac959bcc9ddfd6a2bc6be32102b1f84c.zip
less: upgrade to v581.
MFC after: 2 weeks
Diffstat (limited to 'contrib/less/input.c')
-rw-r--r--contrib/less/input.c45
1 files changed, 35 insertions, 10 deletions
diff --git a/contrib/less/input.c b/contrib/less/input.c
index 526fe4be3bdb..f57c9e3403f2 100644
--- a/contrib/less/input.c
+++ b/contrib/less/input.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1984-2020 Mark Nudelman
+ * Copyright (C) 1984-2021 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.
@@ -31,6 +31,7 @@ extern POSITION end_attnpos;
#if HILITE_SEARCH
extern int hilite_search;
extern int size_linebuf;
+extern int show_attn;
#endif
/*
@@ -41,8 +42,9 @@ extern int size_linebuf;
* of the NEXT line. The line obtained is the line starting at curr_pos.
*/
public POSITION
-forw_line(curr_pos)
+forw_line_seg(curr_pos, get_segpos)
POSITION curr_pos;
+ int get_segpos;
{
POSITION base_pos;
POSITION new_pos;
@@ -104,8 +106,8 @@ get_forw_line:
/*
* Read forward again to the position we should start at.
*/
- prewind();
- plinenum(base_pos);
+ prewind();
+ plinestart(base_pos);
(void) ch_seek(base_pos);
new_pos = base_pos;
while (new_pos < curr_pos)
@@ -180,8 +182,9 @@ get_forw_line:
* is too long to print in the screen width.
* End the line here.
*/
- if (chopline || hshift > 0)
+ if ((chopline || hshift > 0) && !get_segpos)
{
+ /* Read to end of line. */
do
{
if (ABORT_SIGS())
@@ -205,6 +208,13 @@ get_forw_line:
c = ch_forw_get();
}
+#if HILITE_SEARCH
+ if (blankline && show_attn)
+ {
+ /* Add spurious space to carry possible attn hilite. */
+ pappend(' ', ch_tell()-1);
+ }
+#endif
pdone(endline, chopped, 1);
#if HILITE_SEARCH
@@ -218,8 +228,12 @@ get_forw_line:
goto get_forw_line;
}
- if (status_col && is_hilited(base_pos, ch_tell()-1, 1, NULL))
- set_status_col('*');
+ if (status_col)
+ {
+ int attr = is_hilited_attr(base_pos, ch_tell()-1, 1, NULL);
+ if (attr)
+ set_status_col('*', attr);
+ }
#endif
if (squeeze && blankline)
@@ -243,6 +257,13 @@ get_forw_line:
return (new_pos);
}
+ public POSITION
+forw_line(curr_pos)
+ POSITION curr_pos;
+{
+ return forw_line_seg(curr_pos, FALSE);
+}
+
/*
* Get the previous line.
* A "current" position is passed and a "new" position is returned.
@@ -358,7 +379,7 @@ get_back_line:
}
endline = FALSE;
prewind();
- plinenum(new_pos);
+ plinestart(new_pos);
loop:
begin_new_pos = new_pos;
(void) ch_seek(new_pos);
@@ -423,8 +444,12 @@ get_back_line:
goto get_back_line;
}
- if (status_col && curr_pos > 0 && is_hilited(base_pos, curr_pos-1, 1, NULL))
- set_status_col('*');
+ if (status_col && curr_pos > 0)
+ {
+ int attr = is_hilited_attr(base_pos, curr_pos-1, 1, NULL);
+ if (attr)
+ set_status_col('*', attr);
+ }
#endif
return (begin_new_pos);