diff options
Diffstat (limited to 'line.c')
-rw-r--r-- | line.c | 63 |
1 files changed, 31 insertions, 32 deletions
@@ -1,5 +1,5 @@ /* - * 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. @@ -35,7 +35,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; @@ -59,7 +58,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; @@ -162,9 +160,6 @@ prewind() lmargin = 0; if (status_col) lmargin += 1; -#if HILITE_SEARCH - line_matches = 0; -#endif } /* @@ -592,7 +587,6 @@ store_char(ch, a, rep, pos) if (a != AT_ANSI) a |= AT_HILITE; } - line_matches += matches; } #endif @@ -600,9 +594,12 @@ store_char(ch, a, rep, pos) { if (!is_ansi_end(ch) && !is_ansi_middle(ch)) { /* Remove whole unrecognized sequence. */ + char *p = &linebuf[curr]; + LWCHAR bch; do { - --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. */ @@ -992,8 +989,9 @@ pflushmbc() * Terminate the line in the line buffer. */ public void -pdone(endline) +pdone(endline, nextc) int endline; + int nextc; { int nl; @@ -1037,43 +1035,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; } /* |