line.c (720c436c669bf5f7405777dcd50575bf6651e0f8) line.c (1c6a5c10a362fd36b365582979f652431752c99a)
1/* $FreeBSD$ */
2/*
3 * Copyright (C) 1984-2007 Mark Nudelman
4 *
5 * You may distribute under the terms of either the GNU General Public
6 * License or the Less License, as specified in the README file.
7 *
8 * For more information about less, or for information on how to
9 * contact the author, see the README file.

--- 254 unchanged lines hidden (view full) ---

264 to = from = lmargin;
265 /*
266 * We keep on going when shifted == shift
267 * to get all combining chars.
268 */
269 while (shifted <= shift && from < curr)
270 {
271 c = linebuf[from];
1/*
2 * Copyright (C) 1984-2007 Mark Nudelman
3 *
4 * You may distribute under the terms of either the GNU General Public
5 * License or the Less License, as specified in the README file.
6 *
7 * For more information about less, or for information on how to
8 * contact the author, see the README file.

--- 254 unchanged lines hidden (view full) ---

263 to = from = lmargin;
264 /*
265 * We keep on going when shifted == shift
266 * to get all combining chars.
267 */
268 while (shifted <= shift && from < curr)
269 {
270 c = linebuf[from];
272 if (c == ESC && ctldisp == OPT_ONPLUS)
271 if (ctldisp == OPT_ONPLUS && IS_CSI_START(c))
273 {
274 /* Keep cumulative effect. */
275 linebuf[to] = c;
276 attr[to++] = attr[from++];
277 while (from < curr && linebuf[from])
278 {
279 linebuf[to] = linebuf[from];
280 attr[to++] = attr[from];

--- 238 unchanged lines hidden (view full) ---

519
520 /*
521 * Search backwards for either an ESC (which means we ARE in a seq);
522 * or an end char (which means we're NOT in a seq).
523 */
524 for (p = &linebuf[curr]; p > linebuf; )
525 {
526 LWCHAR ch = step_char(&p, -1, linebuf);
272 {
273 /* Keep cumulative effect. */
274 linebuf[to] = c;
275 attr[to++] = attr[from++];
276 while (from < curr && linebuf[from])
277 {
278 linebuf[to] = linebuf[from];
279 attr[to++] = attr[from];

--- 238 unchanged lines hidden (view full) ---

518
519 /*
520 * Search backwards for either an ESC (which means we ARE in a seq);
521 * or an end char (which means we're NOT in a seq).
522 */
523 for (p = &linebuf[curr]; p > linebuf; )
524 {
525 LWCHAR ch = step_char(&p, -1, linebuf);
527 if (ch == ESC)
526 if (IS_CSI_START(ch))
528 return (1);
529 if (!is_ansi_middle(ch))
530 return (0);
531 }
532 return (0);
533}
534
535/*

--- 62 unchanged lines hidden (view full) ---

598#endif
599
600 if (ctldisp == OPT_ONPLUS && in_ansi_esc_seq())
601 {
602 if (!is_ansi_end(ch) && !is_ansi_middle(ch)) {
603 /* Remove whole unrecognized sequence. */
604 do {
605 --curr;
527 return (1);
528 if (!is_ansi_middle(ch))
529 return (0);
530 }
531 return (0);
532}
533
534/*

--- 62 unchanged lines hidden (view full) ---

597#endif
598
599 if (ctldisp == OPT_ONPLUS && in_ansi_esc_seq())
600 {
601 if (!is_ansi_end(ch) && !is_ansi_middle(ch)) {
602 /* Remove whole unrecognized sequence. */
603 do {
604 --curr;
606 } while (linebuf[curr] != ESC);
605 } while (!IS_CSI_START(linebuf[curr]));
607 return 0;
608 }
609 a = AT_ANSI; /* Will force re-AT_'ing around it. */
610 w = 0;
611 }
606 return 0;
607 }
608 a = AT_ANSI; /* Will force re-AT_'ing around it. */
609 w = 0;
610 }
612 else if (ctldisp == OPT_ONPLUS && ch == ESC)
611 else if (ctldisp == OPT_ONPLUS && IS_CSI_START(ch))
613 {
614 a = AT_ANSI; /* Will force re-AT_'ing around it. */
615 w = 0;
616 }
617 else
618 {
619 char *p = &linebuf[curr];
620 LWCHAR prev_ch = step_char(&p, -1, linebuf);

--- 317 unchanged lines hidden (view full) ---

938 case BS_NORMAL:
939 case BS_SPECIAL:
940 STORE_TAB(a, pos);
941 break;
942 }
943 } else if ((!utf_mode || is_ascii_char(ch)) && control_char((char)ch))
944 {
945 do_control_char:
612 {
613 a = AT_ANSI; /* Will force re-AT_'ing around it. */
614 w = 0;
615 }
616 else
617 {
618 char *p = &linebuf[curr];
619 LWCHAR prev_ch = step_char(&p, -1, linebuf);

--- 317 unchanged lines hidden (view full) ---

937 case BS_NORMAL:
938 case BS_SPECIAL:
939 STORE_TAB(a, pos);
940 break;
941 }
942 } else if ((!utf_mode || is_ascii_char(ch)) && control_char((char)ch))
943 {
944 do_control_char:
946 if (ctldisp == OPT_ON || (ctldisp == OPT_ONPLUS && ch == ESC))
945 if (ctldisp == OPT_ON || (ctldisp == OPT_ONPLUS && IS_CSI_START(ch)))
947 {
948 /*
949 * Output as a normal character.
950 */
951 STORE_CHAR(ch, AT_NORMAL, rep, pos);
952 } else
953 {
954 STORE_PRCHAR((char) ch, pos);

--- 275 unchanged lines hidden ---
946 {
947 /*
948 * Output as a normal character.
949 */
950 STORE_CHAR(ch, AT_NORMAL, rep, pos);
951 } else
952 {
953 STORE_PRCHAR((char) ch, pos);

--- 275 unchanged lines hidden ---