force ? " force" : ""))
force ? " force" : ""));
ScrnRefresh (	register TScreen *screen,	int toprow,	int leftcol,	int nrows,	int ncols,	Bool force)			/* ... leading/trailing spaces */{	int y = toprow * FontHeight(screen) + screen->border;	register int row;	register int topline = screen->topline;	int maxrow = toprow + nrows - 1;	int scrollamt = screen->scroll_amt;	int max = screen->max_row;	int gc_changes = 0;#ifdef __CYGWIN__	static char first_time = 1;#endif	TRACE(("ScrnRefresh (%d,%d) - (%d,%d)%s\n",		toprow, leftcol,		nrows, ncols,		force ? " force" : ""))	if(screen->cursor_col >= leftcol	&& screen->cursor_col <= (leftcol + ncols - 1)	&& screen->cursor_row >= toprow + topline	&& screen->cursor_row <= maxrow + topline)		screen->cursor_state = OFF;	for (row = toprow; row <= maxrow; y += FontHeight(screen), row++) {#if OPT_ISO_COLORS	   register Char *fb = 0;#endif#if OPT_DEC_CHRSET	   register Char *cb = 0;#endif	   Char cs = 0;	   register Char *chars;	   register Char *attrs;	   register int col = leftcol;	   int maxcol = leftcol + ncols - 1;	   int hi_col = maxcol;	   int lastind;	   int flags;	   int fg_bg = 0, fg = 0, bg = 0;	   int x;	   GC gc;	   Boolean hilite;	   if (row < screen->top_marg || row > screen->bot_marg)		lastind = row;	   else		lastind = row - scrollamt;	   if (lastind < 0 || lastind > max)	   	continue;	   chars = SCRN_BUF_CHARS(screen, lastind + topline);	   attrs = SCRN_BUF_ATTRS(screen, lastind + topline);	   if_OPT_DEC_CHRSET({		cb = SCRN_BUF_CSETS(screen, lastind + topline);	   })	   if (row < screen->startHRow || row > screen->endHRow ||	       (row == screen->startHRow && maxcol < screen->startHCol) ||	       (row == screen->endHRow && col >= screen->endHCol))	   {#if OPT_DEC_CHRSET	       /*	        * Temporarily change dimensions to double-sized characters so		* we can reuse the recursion on this function.	        */	       if (CSET_DOUBLE(*cb)) {		   col /= 2;		   maxcol /= 2;	       }#endif	       /* row does not intersect selection; don't hilite */	       if (!force) {		   while (col <= maxcol && (attrs[col] & ~BOLD) == 0 &&			  (chars[col] & ~040) == 0)		       col++;		   while (col <= maxcol && (attrs[maxcol] & ~BOLD) == 0 &&			  (chars[maxcol] & ~040) == 0)		       maxcol--;	       }#if OPT_DEC_CHRSET	       if (CSET_DOUBLE(*cb)) {		   col *= 2;		   maxcol *= 2;	       }#endif	       hilite = False;	   }	   else {	       /* row intersects selection; split into pieces of single type */	       if (row == screen->startHRow && col < screen->startHCol) {		   ScrnRefresh(screen, row, col, 1, screen->startHCol - col,			       force);		   col = screen->startHCol;	       }	       if (row == screen->endHRow && maxcol >= screen->endHCol) {		   ScrnRefresh(screen, row, screen->endHCol, 1,			       maxcol - screen->endHCol + 1, force);		   maxcol = screen->endHCol - 1;	       }	       /*		* If we're highlighting because the user is doing cut/paste,		* trim the trailing blanks from the highlighted region so we're		* showing the actual extent of the text that'll be cut.  If		* we're selecting a blank line, we'll highlight one column		* anyway.		*		* We don't do this if the mouse-hilite mode is set because that		* would be too confusing.		*		* The default if the highlightSelection resource isn't set will		* highlight the whole width of the terminal, which is easy to		* see, but harder to use (because trailing blanks aren't as		* apparent).	        */	       if (screen->highlight_selection		&& screen->send_mouse_pos != VT200_HIGHLIGHT_MOUSE) {		   hi_col = screen->max_col;	           while (hi_col > 0 && !(attrs[hi_col] & CHARDRAWN))                       hi_col--;	       }	       /* remaining piece should be hilited */	       hilite = True;	   }	   if (col > maxcol) continue;	   /*	    * Go back to double-sized character dimensions if the line has	    * double-width characters.  Note that 'hi_col' is already in the	    * right units.	    */	   if_OPT_DEC_CHRSET({		if (CSET_DOUBLE(*cb)) {			col /= 2;			maxcol /= 2;		}		cs = cb[col];	   })	   flags = attrs[col];	   if_OPT_ISO_COLORS(screen,{		fb = SCRN_BUF_COLOR(screen, lastind + topline);		fg_bg = fb[col];		fg = extract_fg(fg_bg, flags);		bg = extract_bg(fg_bg);	   })	   gc = updatedXtermGC(screen, flags, fg_bg, hilite);	   gc_changes |= (flags & (FG_COLOR|BG_COLOR));	   x = CurCursorX(screen, row, col);	   lastind = col;	   for (; col <= maxcol; col++) {		if ((attrs[col] != flags)		 || (hilite && (col > hi_col))#if OPT_ISO_COLORS		 || ((flags & FG_COLOR) && (extract_fg(fb[col],attrs[col]) != fg))		 || ((flags & BG_COLOR) && (extract_bg(fb[col]) != bg))#endif#if OPT_DEC_CHRSET		 || (cb[col] != cs)#endif		 ) {		   TRACE(("%s @%d, calling drawXtermText %d..%d\n", __FILE__, __LINE__, lastind, col))		   x = drawXtermText(screen, flags, gc, x, y,		   	cs,			&chars[lastind], col - lastind);		   resetXtermGC(screen, flags, hilite);		   lastind = col;		   if (hilite && (col > hi_col))			hilite = False;		   flags = attrs[col];		   if_OPT_ISO_COLORS(screen,{			fg_bg = fb[col];		        fg = extract_fg(fg_bg, flags);		        bg = extract_bg(fg_bg);		   })		   if_OPT_DEC_CHRSET({		        cs = cb[col];		   })	   	   gc = updatedXtermGC(screen, flags, fg_bg, hilite);	   	   gc_changes |= (flags & (FG_COLOR|BG_COLOR));		}		if(chars[col] == 0)			chars[col] = ' ';	   }	   TRACE(("%s @%d, calling drawXtermText %d..%d\n", __FILE__, __LINE__, lastind, col))	   drawXtermText(screen, flags, gc, x, y,	   	cs,		&chars[lastind], col - lastind);	   resetXtermGC(screen, flags, hilite);	}