2c2
< $Id: display.c,v 1.6 1997/07/24 21:13:27 karl Exp $
---
> $Id: display.c,v 1.7 2002/03/08 21:41:44 karl Exp $
105a106,107
> int pl_ignore = 0; /* How many chars use zero width on screen. */
> int allocated_win_width;
126c128,129
< printed_line = (char *)xmalloc (1 + win->width);
---
> allocated_win_width = win->width + 1;
> printed_line = (char *)xmalloc (allocated_win_width);
150c153
< replen = win->width - pl_index;
---
> replen = win->width - pl_index + pl_ignore;
158a162,178
> /* Support ANSI escape sequences under -R. */
> if (raw_escapes_p
> && *nodetext == '\033'
> && nodetext[1] == '['
> && isdigit (nodetext[2]))
> {
> if (nodetext[3] == 'm')
> pl_ignore += 4;
> else if (isdigit (nodetext[3]) && nodetext[4] == 'm')
> pl_ignore += 5;
> }
> while (pl_index + 2 >= allocated_win_width - 1)
> {
> allocated_win_width *= 2;
> printed_line = (char *)xrealloc (printed_line, allocated_win_width);
> }
>
161c181
< if (replen + pl_index < win->width)
---
> if (replen + pl_index < win->width + pl_ignore)
192c212
< for (i = 0; pl_index < (win->width - 1);)
---
> for (i = 0; pl_index < (win->width + pl_ignore - 1);)
217c237,239
< if (entry->inverse)
---
> if (entry->inverse
> /* Need to erase the line if it has escape sequences. */
> || (raw_escapes_p && strchr (entry->text, '\033') != 0))
245,246c267,269
< if ((pl_index < win->width && pl_index < entry->textlen) ||
< (entry->inverse))
---
> if ((pl_index < win->width + pl_ignore
> && pl_index < entry->textlen)
> || (entry->inverse))
251a275,281
> if (strlen (printed_line) > screenwidth)
> /* printed_line[] can include more than screenwidth
> characters if we are under -R and there are escape
> sequences in it. However, entry->text was
> allocated (in display_initialize_display) for
> screenwidth characters only. */
> entry->text = xrealloc (entry->text, strlen (printed_line)+1);
276a307
> pl_ignore = 0; /* this is computed per line */
< $Id: display.c,v 1.6 1997/07/24 21:13:27 karl Exp $
---
> $Id: display.c,v 1.7 2002/03/08 21:41:44 karl Exp $
105a106,107
> int pl_ignore = 0; /* How many chars use zero width on screen. */
> int allocated_win_width;
126c128,129
< printed_line = (char *)xmalloc (1 + win->width);
---
> allocated_win_width = win->width + 1;
> printed_line = (char *)xmalloc (allocated_win_width);
150c153
< replen = win->width - pl_index;
---
> replen = win->width - pl_index + pl_ignore;
158a162,178
> /* Support ANSI escape sequences under -R. */
> if (raw_escapes_p
> && *nodetext == '\033'
> && nodetext[1] == '['
> && isdigit (nodetext[2]))
> {
> if (nodetext[3] == 'm')
> pl_ignore += 4;
> else if (isdigit (nodetext[3]) && nodetext[4] == 'm')
> pl_ignore += 5;
> }
> while (pl_index + 2 >= allocated_win_width - 1)
> {
> allocated_win_width *= 2;
> printed_line = (char *)xrealloc (printed_line, allocated_win_width);
> }
>
161c181
< if (replen + pl_index < win->width)
---
> if (replen + pl_index < win->width + pl_ignore)
192c212
< for (i = 0; pl_index < (win->width - 1);)
---
> for (i = 0; pl_index < (win->width + pl_ignore - 1);)
217c237,239
< if (entry->inverse)
---
> if (entry->inverse
> /* Need to erase the line if it has escape sequences. */
> || (raw_escapes_p && strchr (entry->text, '\033') != 0))
245,246c267,269
< if ((pl_index < win->width && pl_index < entry->textlen) ||
< (entry->inverse))
---
> if ((pl_index < win->width + pl_ignore
> && pl_index < entry->textlen)
> || (entry->inverse))
251a275,281
> if (strlen (printed_line) > screenwidth)
> /* printed_line[] can include more than screenwidth
> characters if we are under -R and there are escape
> sequences in it. However, entry->text was
> allocated (in display_initialize_display) for
> screenwidth characters only. */
> entry->text = xrealloc (entry->text, strlen (printed_line)+1);
276a307
> pl_ignore = 0; /* this is computed per line */