summaryrefslogtreecommitdiffstats
path: root/contrib/less/line.c
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2009-05-09 01:35:27 +0000
committerdelphij <delphij@FreeBSD.org>2009-05-09 01:35:27 +0000
commit810e5a84b4607c4d0fc76e9a418ae9fd2b0eeeb2 (patch)
tree5e0628caeff31611fab89dbdf72053148a59a873 /contrib/less/line.c
parent8583a840068803e7fd9e0fc2452605bca6e822d8 (diff)
downloadFreeBSD-src-810e5a84b4607c4d0fc76e9a418ae9fd2b0eeeb2.zip
FreeBSD-src-810e5a84b4607c4d0fc76e9a418ae9fd2b0eeeb2.tar.gz
Update to less v429.
Diffstat (limited to 'contrib/less/line.c')
-rw-r--r--contrib/less/line.c67
1 files changed, 32 insertions, 35 deletions
diff --git a/contrib/less/line.c b/contrib/less/line.c
index 11122a5..b3d9c2f 100644
--- a/contrib/less/line.c
+++ b/contrib/less/line.c
@@ -1,6 +1,6 @@
/* $FreeBSD$ */
/*
- * 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.
@@ -36,7 +36,6 @@ static int overstrike; /* Next char should overstrike previous char */
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;
@@ -60,7 +59,6 @@ extern int bl_s_width, bl_e_width;
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;
@@ -163,9 +161,6 @@ prewind()
lmargin = 0;
if (status_col)
lmargin += 1;
-#if HILITE_SEARCH
- line_matches = 0;
-#endif
}
/*
@@ -593,7 +588,6 @@ store_char(ch, a, rep, pos)
if (a != AT_ANSI)
a |= AT_HILITE;
}
- line_matches += matches;
}
#endif
@@ -601,11 +595,12 @@ store_char(ch, a, rep, pos)
{
if (!is_ansi_end(ch) && !is_ansi_middle(ch)) {
/* Remove whole unrecognized sequence. */
- while (curr) {
- --curr;
- if (IS_CSI_START(linebuf[curr]))
- break;
- }
+ char *p = &linebuf[curr];
+ LWCHAR bch;
+ do {
+ 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. */
@@ -995,8 +990,9 @@ pflushmbc()
* Terminate the line in the line buffer.
*/
public void
-pdone(endline)
+pdone(endline, nextc)
int endline;
+ int nextc;
{
int nl;
@@ -1040,43 +1036,44 @@ pdone(endline)
* 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;
}
/*
OpenPOWER on IntegriCloud