Example #1
0
void
redrawwin(void)
{
    register screenline_t *bp;
    register int    i, j;
    int len;

    o_clear();
    for (tc_col = tc_line = i = 0, j = roll; i < t_lines; i++, j++) {
	if (j >= t_lines)
	    j = 0;
	bp = &big_picture[j];
	if ((len = bp->len)) {
	    rel_move(tc_col, tc_line, 0, i);

#ifdef DBCSAWARE
	    if (!(bp->mode & STANDOUT) &&
		    (HasUserFlag(UF_DBCS_NOINTRESC)) &&
		    DBCS_RemoveIntrEscape(bp->data, &len))
	    {
		// if anything changed, dirty whole line.
		bp->len = len;
	    }
#endif // DBCSAWARE

	    if (bp->mode & STANDOUT) {
		standoutput((char *)bp->data, 0, len, bp->sso, bp->eso);
	    }
	    else
		output((char *)bp->data, len);
	    tc_col += len;
	    if (tc_col >= t_columns) {
		if (automargins)
		    tc_col = t_columns - 1;
		else {
		    tc_col -= t_columns;
		    tc_line++;
		    if (tc_line >= t_lines)
			tc_line = b_lines;
		}
	    }
	    bp->mode &= ~(MODIFIED);
	    bp->oldlen = len;
	}
    }
    rel_move(tc_col, tc_line, cur_col, cur_ln);
    docls = scrollcnt = 0;
    oflush();
}
Example #2
0
void
redoscr()
{
  register screenline *bp;
  register int i, j, len;

  o_clear();
  for (tc_col = tc_line = i = 0, j = roll; i < scr_lns; i++, j++)
  {
    if (j >= scr_lns)
      j = 0;
    bp = &big_picture[j];
    if (len = bp->len)
    {
      rel_move(0, i);

      if (bp->mode & STANDOUT)
	standoutput(bp->data, 0, len, bp->sso, bp->eso);
      else
	output(bp->data, len);
      tc_col += len;
      if (tc_col >= scr_cols)
      {
	if (automargins)
	  tc_col = scr_cols - 1;
	else
	{
	  tc_col -= scr_cols;
	  tc_line++;
	  if (tc_line >= t_lines)
	    tc_line = b_lines;
	}
      }
      bp->mode &= ~(MODIFIED);
      bp->oldlen = len;
    }
  }
  rel_move(cur_col, cur_ln);
  docls = scrollcnt = 0;
  oflush();
}
Example #3
0
void
doupdate(void)
{
    /* TODO remove unnecessary refresh() call, to save CPU time */
    register screenline_t *bp = big_picture;
    register int    i, j;
    int len;
    if ((docls) || (abs(scrollcnt) >= (t_lines - 3))) {
	redrawwin();
	return;
    }
    if (scrollcnt < 0) {
	if (!scrollrevlen) {
	    redrawwin();
	    return;
	}
	rel_move(tc_col, tc_line, 0, 0);
	do {
	    o_scrollrev();
	} while (++scrollcnt);
    } else if (scrollcnt > 0) {
	rel_move(tc_col, tc_line, 0, b_lines);
	do {
	    ochar('\n');
	} while (--scrollcnt);
    }
    for (i = 0, j = roll; i < t_lines; i++, j++) {
	if (j >= t_lines)
	    j = 0;
	bp = &big_picture[j];
	len = bp->len;

	if (bp->mode & MODIFIED && bp->smod < len) 
	{
	    bp->mode &= ~(MODIFIED);

#ifdef DBCSAWARE
	    if (!(bp->mode & STANDOUT) &&
		(HasUserFlag(UF_DBCS_NOINTRESC)) &&
		DBCS_RemoveIntrEscape(bp->data, &len))
	    {
		// if anything changed, dirty whole line.
		bp->len = len;
		bp->smod = 0; bp->emod = len;
	    }
#endif // DBCSAWARE

// disable this if you encounter some bugs.
// bug history:
// (1) input number (goto) in bbs list (search_num) [solved: search_num merged to vget]
// (2) some empty lines becomes weird (eg, b_config) [not seen anymore?]
#if 1
	    if (bp->smod > 0)
	    {
		// more effort to determine ANSI smod
		int iesc;
		for (iesc = bp->smod-1; iesc >= 0; iesc--)
		{
		    if (bp->data[iesc] == ESC_CHR)
		    {
			bp->smod = 0;// iesc;
			bp->emod =len -1;
			break;
		    }
		}
	    }
#endif
	    
	    if (bp->emod >= len)
		bp->emod = len - 1;
	    rel_move(tc_col, tc_line, bp->smod, i);

	    if (bp->mode & STANDOUT)
		standoutput((char *)bp->data, bp->smod, bp->emod + 1,
			    bp->sso, bp->eso);
	    else
		output((char *)&bp->data[bp->smod], bp->emod - bp->smod + 1);
	    tc_col = bp->emod + 1;
	    if (tc_col >= t_columns) {
		if (automargins)
		    tc_col = t_columns - 1;
		else {
		    tc_col -= t_columns;
		    tc_line++;
		    if (tc_line >= t_lines)
			tc_line = b_lines;
		}
	    }
	}
	if (bp->oldlen > len) {
	    /* XXX len/oldlen also count the length of escape sequence,
	     * before we fix it, we must print ANSI_CLRTOEND everywhere */
	    rel_move(tc_col, tc_line, len, i);
	    o_cleol();
	}
	bp->oldlen = len;
    }

    rel_move(tc_col, tc_line, cur_col, cur_ln);

    oflush();
}
Example #4
0
void
refresh()
{
  register screenline *bp = big_picture;
  register int i, j, len;

  if (icurrchar != ibufsize)
    return;

  if ((docls) || (abs(scrollcnt) >= (scr_lns - 3)))
  {
    redoscr();
    return;
  }

  if (scrollcnt < 0)
  {
    rel_move(0, 0);
    do
    {
      o_scrollrev();
    } while (++scrollcnt);
  }
  else if (scrollcnt > 0)
  {
    rel_move(0, b_lines);
    do
    {
      ochar('\n');
    } while (--scrollcnt);
  }

  for (i = 0, j = roll; i < scr_lns; i++, j++)
  {
    if (j >= scr_lns)
      j = 0;
    bp = &big_picture[j];
    len = bp->len;
    if (bp->mode & MODIFIED && bp->smod < len)
    {
      bp->mode &= ~(MODIFIED);
      if (bp->emod >= len)
	bp->emod = len - 1;
      rel_move(bp->smod, i);

      if (bp->mode & STANDOUT)
	standoutput(bp->data, bp->smod, bp->emod + 1, bp->sso, bp->eso);
      else
	output(&bp->data[bp->smod], bp->emod - bp->smod + 1);
      tc_col = bp->emod + 1;
      if (tc_col >= scr_cols)
      {
	if (automargins)
	  tc_col = scr_cols - 1;
	else
	{
	  tc_col -= scr_cols;
	  tc_line++;
	  if (tc_line >= t_lines)
	    tc_line = b_lines;
	}
      }
    }

    if (bp->oldlen > len)
    {
      rel_move(len, i);
      o_cleol();
    }
    bp->oldlen = len;
  }
  rel_move(cur_col, cur_ln);
  oflush();
}