"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "line.c" between
less-580.tar.gz and less-581.tar.gz

About: less is a file pager (a program that displays text files similar to "more" or "pg"). Beta version.

line.c  (less-580):line.c  (less-581)
skipping to change at line 579 skipping to change at line 579
*/ */
public void public void
skip_ansi(pansi, pp, limit) skip_ansi(pansi, pp, limit)
struct ansi_state *pansi; struct ansi_state *pansi;
char **pp; char **pp;
constant char *limit; constant char *limit;
{ {
LWCHAR c; LWCHAR c;
do { do {
c = step_char(pp, +1, limit); c = step_char(pp, +1, limit);
} while (*pp < limit && ansi_step(pansi, c) != ANSI_MID); } while (*pp < limit && ansi_step(pansi, c) == ANSI_MID);
/* Note that we discard final char, for which is_ansi_end is true. */ /* Note that we discard final char, for which is_ansi_end is true. */
} }
/* /*
* Determine if a character starts an ANSI escape sequence. * Determine if a character starts an ANSI escape sequence.
* If so, return an ansi_state struct; otherwise return NULL. * If so, return an ansi_state struct; otherwise return NULL.
*/ */
public struct ansi_state * public struct ansi_state *
ansi_start(ch) ansi_start(ch)
LWCHAR ch; LWCHAR ch;
skipping to change at line 624 skipping to change at line 624
if (ch == '\7') if (ch == '\7')
return ANSI_END; return ANSI_END;
if (pansi->prev_esc && ch == '\\') if (pansi->prev_esc && ch == '\\')
return ANSI_END; return ANSI_END;
pansi->prev_esc = (ch == ESC); pansi->prev_esc = (ch == ESC);
return ANSI_MID; return ANSI_MID;
} }
if (pansi->hindex >= 0) if (pansi->hindex >= 0)
{ {
static char hlink_prefix[] = ESCS "]8;"; static char hlink_prefix[] = ESCS "]8;";
if (ch == hlink_prefix[pansi->hindex++] || if (ch == hlink_prefix[pansi->hindex] ||
(pansi->hindex == 0 && IS_CSI_START(ch))) (pansi->hindex == 0 && IS_CSI_START(ch)))
{ {
pansi->hindex++;
if (hlink_prefix[pansi->hindex] == '\0') if (hlink_prefix[pansi->hindex] == '\0')
pansi->hlink = 1; /* now processing hyperlink add r */ pansi->hlink = 1; /* now processing hyperlink add r */
return ANSI_MID; return ANSI_MID;
} }
pansi->hindex = -1; /* not a hyperlink */ pansi->hindex = -1; /* not a hyperlink */
} }
/* Check for SGR sequences */ /* Check for SGR sequences */
if (is_ansi_middle(ch)) if (is_ansi_middle(ch))
return ANSI_MID; return ANSI_MID;
if (is_ansi_end(ch)) if (is_ansi_end(ch))
skipping to change at line 965 skipping to change at line 966
case ANSI_MID: case ANSI_MID:
STORE_CHAR(ch, AT_ANSI, rep, pos); STORE_CHAR(ch, AT_ANSI, rep, pos);
break; break;
case ANSI_END: case ANSI_END:
STORE_CHAR(ch, AT_ANSI, rep, pos); STORE_CHAR(ch, AT_ANSI, rep, pos);
ansi_done(line_ansi); ansi_done(line_ansi);
line_ansi = NULL; line_ansi = NULL;
break; break;
case ANSI_ERR: { case ANSI_ERR: {
/* Remove whole unrecognized sequence. */ /* Remove whole unrecognized sequence. */
char *p = &linebuf.buf[linebuf.end]; char *start = (cshift < hshift) ? shifted_ansi.buf : linebuf.buf;
int *end = (cshift < hshift) ? &shifted_ansi.end : &linebuf.end;
char *p = start + *end;
LWCHAR bch; LWCHAR bch;
do { do {
bch = step_char(&p, -1, linebuf.buf); bch = step_char(&p, -1, start);
} while (p > linebuf.buf && !IS_CSI_START(bch)); } while (p > start && !IS_CSI_START(bch));
linebuf.end = (int) (p - linebuf.buf); *end = (int) (p - start);
ansi_done(line_ansi);
line_ansi = NULL;
break; } break; }
} }
return (0); return (0);
} }
static int static int
store_bs(ch, rep, pos) store_bs(ch, rep, pos)
LWCHAR ch; LWCHAR ch;
char *rep; char *rep;
POSITION pos; POSITION pos;
 End of changes. 5 change blocks. 
6 lines changed or deleted 11 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)