--- rxvt-unicode/src/screen.C 2008/11/05 00:01:01 1.324 +++ rxvt-unicode/src/screen.C 2011/01/20 17:39:29 1.364 @@ -30,9 +30,10 @@ #include -#include "salloc.C" // HACK, should be a seperate compile! +#include "salloc.C" // HACK, should be a separate compile! -static inline void fill_text (text_t *start, text_t value, int len) +static inline void +fill_text (text_t *start, text_t value, int len) { while (len--) *start++ = value; @@ -145,6 +146,8 @@ rend_t rend = l.r[col] & ~RS_baseattrMask; rend = SET_FONT (rend, FONTSET (rend)->find_font (' ')); + l.touch (); + // found start, nuke do { l.t[col] = ' '; @@ -160,8 +163,6 @@ void rxvt_term::scr_reset () { - scr_soft_reset (); - view_start = 0; num_scr = 0; @@ -235,6 +236,8 @@ selection.op = SELECTION_CLEAR; selection.screen = PRIMARY; selection.clicks = 0; + selection.clip_text = NULL; + selection.clip_len = 0; } else { @@ -282,6 +285,7 @@ { // Re-wrap lines. This is rather ugly, possibly because I am too dumb // to come up with a lean and mean algorithm. + // TODO: maybe optimise when width didn't change row_col_t ocur = screen.cur; ocur.row = MOD (term_start + ocur.row, prev_total_rows); @@ -289,9 +293,7 @@ do { p = MOD (p - 1, prev_total_rows); -#ifdef DEBUG_STRICT assert (old_buf [MOD (p, prev_total_rows)].t); -#endif int plines = 1; int llen = old_buf [MOD (p, prev_total_rows)].l; @@ -397,6 +399,12 @@ clamp_it (screen.cur.col, 0, ncol - 1); } + free (tabs); + tabs = (char *)rxvt_malloc (ncol); + + for (int col = ncol; col--; ) + tabs [col] = col % TABSIZE == 0; + CLEAR_ALL_SELECTION (); prev_nrow = nrow; @@ -438,6 +446,8 @@ { scr_release (); prev_nrow = prev_ncol = 0; + rvideo_mode = false; + scr_soft_reset (); scr_reset (); scr_clear (true); @@ -452,17 +462,9 @@ scr_overlay_off (); #endif - rvideo_mode = false; - if (current_screen != PRIMARY) scr_swap_screen (); - free (tabs); - tabs = (char *)rxvt_malloc (ncol); - - for (int col = ncol; --col; ) - tabs [col] = col % TABSIZE == 0; - scr_scroll_region (0, MAX_ROWS - 1); scr_rendition (0, ~RS_None); scr_insert_mode (0); @@ -513,10 +515,8 @@ /* boundary check in case screen size changed between SAVE and RESTORE */ min_it (s->cur.row, nrow - 1); min_it (s->cur.col, ncol - 1); -#ifdef DEBUG_STRICT assert (s->cur.row >= 0); assert (s->cur.col >= 0); -#endif } void @@ -551,7 +551,7 @@ selection_check (2); /* check for boundary cross */ - int i = current_screen; current_screen = scrn; scrn = i; + current_screen = scrn; #if NSCREENS if (option (Opt_secondaryScreen)) @@ -786,11 +786,9 @@ } } -#ifdef DEBUG_STRICT assert (screen.cur.col < ncol); assert (screen.cur.row < nrow && screen.cur.row >= top_row); -#endif int row = screen.cur.row; checksel = selection.op && current_screen == selection.screen ? 1 : 0; @@ -904,25 +902,29 @@ # endif #endif - // nuke the character at this position, if required - if (expect_false ( - line->t[screen.cur.col] == NOCHAR - || (screen.cur.col < ncol - 1 - && line->t[screen.cur.col + 1] == NOCHAR) - )) - scr_kill_char (*line, screen.cur.col); - rend_t rend = SET_FONT (rstyle, FONTSET (rstyle)->find_font (c)); // if the character doesn't fit into the remaining columns... if (expect_false (screen.cur.col > ncol - width && ncol >= width)) { - // ... artificially enlargen the previous one - c = NOCHAR; - // and try the same character next loop iteration - --str; + if (screen.flags & Screen_Autowrap) + { + // ... artificially enlargen the previous one + c = NOCHAR; + // and try the same character next loop iteration + --str; + } + else + screen.cur.col = ncol - width; } + // nuke the character at this position, if required + // due to wonderful coincidences everywhere else in this loop + // we never have to check for overwriting a wide char itself, + // only its tail. + if (expect_false (line->t[screen.cur.col] == NOCHAR)) + scr_kill_char (*line, screen.cur.col); + line->touch (); do @@ -937,7 +939,8 @@ line->l = ncol; if (screen.flags & Screen_Autowrap) screen.flags |= Screen_WrapNext; - break; + + goto end_of_line; } c = NOCHAR; @@ -945,16 +948,14 @@ while (expect_false (--width > 0)); // pad with spaces when overwriting wide character with smaller one - if (expect_false (!width)) + for (int c = screen.cur.col; expect_false (c < ncol && line->t[c] == NOCHAR); c++) { - line->touch (); - - for (int c = screen.cur.col; c < ncol && line->t[c] == NOCHAR; c++) - { - line->t[c] = ' '; - line->r[c] = rend; - } + line->t[c] = ' '; + line->r[c] = rend; } + +end_of_line: + ; } #if ENABLE_COMBINING else // width == 0 @@ -1004,9 +1005,7 @@ max_it (line->l, screen.cur.col); -#ifdef DEBUG_STRICT assert (screen.cur.row >= 0); -#endif } /* ------------------------------------------------------------------------- */ @@ -1029,6 +1028,8 @@ #endif } } + else if (screen.flags & Screen_WrapNext) + screen.flags &= ~Screen_WrapNext; else scr_gotorc (0, -1, RELATIVE); } @@ -1344,16 +1345,13 @@ min_it (num, nrow - row); - // TODO: the code below does not work when view_start != 0 - // the workaround is to disable the clear and use a normal refresh - // when view_start != 0. mysterious. - if (rstyle & (RS_RVid | RS_Uline)) + if (rstyle & (RS_Blink | RS_RVid | RS_Uline)) ren = (rend_t) ~RS_None; else if (GET_BASEBG (rstyle) == Color_bg) { ren = DEFAULT_RSTYLE; - if (mapped && !view_start) + if (mapped) XClearArea (dpy, vt, 0, Row2Pixel (row - view_start), (unsigned int)width, (unsigned int)Height2Pixel (num), False); @@ -1362,7 +1360,7 @@ { ren = rstyle & (RS_fgMask | RS_bgMask); - if (mapped && !view_start) + if (mapped) { gcvalue.foreground = pix_colors[bgcolor_of (rstyle)]; XChangeGC (dpy, gc, GCForeground, &gcvalue); @@ -1379,8 +1377,8 @@ { scr_blank_screen_mem (ROW(row), rstyle); - if (!view_start) - scr_blank_line (drawn_buf [row], 0, ncol, ren); + if (row - view_start < nrow) + scr_blank_line (drawn_buf [row - view_start], 0, ncol, ren); } } @@ -1543,8 +1541,7 @@ line->r[col] = line->r[col + count]; } - scr_blank_line (*line, ncol - count, count, - line->r[ncol - 1] & (RS_fgMask | RS_bgMask | RS_baseattrMask)); + scr_blank_line (*line, ncol - count, count, rstyle); if (selection.op && current_screen == selection.screen && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)) @@ -1844,7 +1841,7 @@ min_it (rc[i].col, ncol - 1); min_it (rc[i].row, nrow - 1); } -// TODO: this line somehow causes segfault if scr_expose() is called just after resize + for (i = rc[PART_BEG].row; i <= rc[PART_END].row; i++) fill_text (&drawn_buf[i].t[rc[PART_BEG].col], 0, rc[PART_END].col - rc[PART_BEG].col + 1); @@ -1945,6 +1942,7 @@ } else XBell (dpy, 0); + HOOK_INVOKE ((this, HOOK_BELL, DT_END)); #endif } @@ -1973,7 +1971,7 @@ wctomb (0, 0); - for (int r1 = 0; r1 < nrows; r1++) + for (int r1 = row_start; r1 < row_start + nrows; r1++) { text_t *tp = ROW(r1).t; int len = ROW(r1).l; @@ -2012,8 +2010,6 @@ void rxvt_term::scr_refresh () NOTHROW { - unsigned char have_bg, - showcursor; /* show the cursor */ int16_t col, row, /* column/row we're processing */ ocrow; /* old cursor row */ int i; /* tmp */ @@ -2034,7 +2030,8 @@ */ refresh_count = 0; - have_bg = 0; + unsigned int old_screen_flags = screen.flags; + char have_bg = 0; #ifdef HAVE_BG_PIXMAP have_bg = bgPixmap.pixmap != None; #endif @@ -2045,13 +2042,19 @@ */ scr_reverse_selection (); + HOOK_INVOKE ((this, HOOK_REFRESH_BEGIN, DT_END)); +#if ENABLE_OVERLAY + scr_swap_overlay (); +#endif + + char showcursor = screen.flags & Screen_VisibleCursor; + /* * C: set the cursor character (s) */ { unsigned char setoldcursor; - showcursor = (screen.flags & Screen_VisibleCursor); #ifdef CURSOR_BLINK if (hidden_cursor) showcursor = 0; @@ -2089,7 +2092,7 @@ ccol2 = Color_bg; #endif - if (showcursor && focus) + if (focus) { if (option (Opt_cursorUnderline)) *crp ^= RS_Uline; @@ -2134,11 +2137,6 @@ } } - HOOK_INVOKE ((this, HOOK_REFRESH_BEGIN, DT_END)); -#if ENABLE_OVERLAY - scr_swap_overlay (); -#endif - #ifndef NO_SLOW_LINK_SUPPORT /* * D: CopyArea pass - very useful for slower links @@ -2240,7 +2238,7 @@ while (expect_false (stp[col] == NOCHAR && col > 0)) --col; - rend_t rend = srp[col]; /* screen rendition (target rendtion) */ + rend_t rend = srp[col]; /* screen rendition (target rendition) */ text_t *text = stp + col; int count = 1; @@ -2254,7 +2252,8 @@ if (stp[col] == NOCHAR) { dtp[col] = stp[col]; - drp[col] = rend; + drp[col] = srp[col]; + count++; i++; @@ -2294,7 +2293,7 @@ int back = bgcolor_of (rend); // desired background // only do special processing if any attributes are set, which is unlikely - if (expect_false (rend & (RS_Bold | RS_Italic | RS_Uline | RS_RVid | RS_Blink | RS_Careful))) + if (expect_false (rend & (RS_baseattrMask | RS_Careful | RS_Sel))) { bool invert = rend & RS_RVid; @@ -2323,25 +2322,31 @@ fore = Color_UL; #endif - if (invert) - { #ifdef OPTION_HC - if ((showcursor && row == screen.cur.row && text - stp == screen.cur.col) - || !ISSET_PIXCOLOR (Color_HC)) + if (rend & RS_Sel) + { + /* invert the column if no highlightColor is set or it is the + * current cursor column */ + if (!(showcursor && row == screen.cur.row && text - stp == screen.cur.col) + && ISSET_PIXCOLOR (Color_HC)) + { + if (ISSET_PIXCOLOR (Color_HTC)) + fore = Color_HTC; + // if invert is 0 reverse video is set so we use bg color as fg color + else if (!invert) + fore = back; + + back = Color_HC; + invert = 0; + } + } #endif - /* invert the column if no highlightColor is set or it is the - * current cursor column */ + + if (invert) + { ::swap (fore, back); -#ifdef OPTION_HC - else if (ISSET_PIXCOLOR (Color_HC)) - back = Color_HC; -#endif #ifndef NO_BOLD_UNDERLINE_REVERSE -# ifndef OPTION_HC - if (ISSET_PIXCOLOR (Color_RV)) - back = Color_RV; -# endif if (fore == back) { fore = Color_bg; @@ -2420,11 +2425,6 @@ } /* for (col....) */ } /* for (row....) */ -#if ENABLE_OVERLAY - scr_swap_overlay (); -#endif - HOOK_INVOKE ((this, HOOK_REFRESH_END, DT_END)); - /* * G: cleanup cursor and display outline cursor if necessary */ @@ -2472,8 +2472,14 @@ /* * H: cleanup selection */ +#if ENABLE_OVERLAY + scr_swap_overlay (); +#endif + HOOK_INVOKE ((this, HOOK_REFRESH_END, DT_END)); + scr_reverse_selection (); + screen.flags = old_screen_flags; num_scr = 0; num_scr_allow = 1; } @@ -2504,28 +2510,52 @@ } void -rxvt_term::scr_recolour () NOTHROW +rxvt_term::scr_recolour (bool refresh) NOTHROW { + bool transparent = false; + #ifdef HAVE_BG_PIXMAP - bgPixmap.apply (); -#else + if (bgPixmap.pixmap != None) + { +# ifdef ENABLE_TRANSPARENCY + if (bgPixmap.flags & bgPixmap_t::isTransparent) + { + XSetWindowBackgroundPixmap (dpy, parent[0], bgPixmap.pixmap); + XSetWindowBackgroundPixmap (dpy, vt, ParentRelative); + + transparent = true; + } + else +# endif + { + XSetWindowBackground (dpy, parent[0], pix_colors[Color_border]); + XSetWindowBackgroundPixmap (dpy, vt, bgPixmap.pixmap); + } + } + else +#endif + { + XSetWindowBackground (dpy, parent[0], pix_colors[Color_border]); + XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); + } - XSetWindowBackground (dpy, parent[0], pix_colors[Color_border]); XClearWindow (dpy, parent[0]); - XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); if (scrollBar.win) - { - XSetWindowBackground (dpy, scrollBar.win, pix_colors[Color_border]); - scrollBar.state = STATE_IDLE; - scrollBar.show (0); - } - -#endif + { + if (transparent) + XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative); + else + XSetWindowBackground (dpy, scrollBar.win, pix_colors[Color_border]); + scrollBar.state = STATE_IDLE; + scrollBar.show (0); + } - /* bgPixmap.apply () does not do the following : */ - scr_clear (); - scr_touch (true); + if (refresh) + { + scr_clear (); + scr_touch (true); + } want_refresh = 1; } @@ -2603,12 +2633,12 @@ if (selection.rect) scr_xor_rect (selection.beg.row, selection.beg.col, selection.end.row, selection.end.col, - RS_RVid, RS_RVid | RS_Uline); + RS_Sel | RS_RVid, RS_Sel | RS_RVid | RS_Uline); else #endif scr_xor_span (selection.beg.row, selection.beg.col, selection.end.row, selection.end.col, - RS_RVid); + RS_Sel | RS_RVid); } } @@ -2623,7 +2653,7 @@ { int row, wrote; unsigned int width, towrite; - char r1[] = "\n"; + const char r1[] = "\n"; for (row = saveLines + top_row; row < saveLines + nrow - 1; row++) @@ -2679,7 +2709,7 @@ * Paste a selection direct to the command fd */ void -rxvt_term::paste (char *data, unsigned int len) NOTHROW +rxvt_term::tt_paste (char *data, unsigned int len) NOTHROW { /* convert normal newline chars into common keyboard Return key sequence */ for (unsigned int i = 0; i < len; i++) @@ -2695,6 +2725,15 @@ tt_printf ("\e[201~"); } +void +rxvt_term::paste (char *data, unsigned int len) NOTHROW +{ + if (HOOK_INVOKE ((this, HOOK_TT_PASTE, DT_STR_LEN, data, len, DT_END))) + return; + + tt_paste (data, len); +} + /* ------------------------------------------------------------------------- */ /* * Respond to a notification that a primary selection has been sent @@ -2759,7 +2798,7 @@ goto bailout; // realloc should be compatible to XFree, here, and elsewhere, too - ct.value = (unsigned char *)realloc (ct.value, ct.nitems + ct2.nitems + 1); + ct.value = (unsigned char *)rxvt_realloc (ct.value, ct.nitems + ct2.nitems + 1); memcpy (ct.value + ct.nitems, ct2.value, ct2.nitems + 1); ct.nitems += ct2.nitems; @@ -2818,7 +2857,7 @@ while (incr_buf_fill + ct.nitems > incr_buf_size) { incr_buf_size = incr_buf_size ? incr_buf_size * 2 : 128*1024; - incr_buf = (char *)realloc (incr_buf, incr_buf_size); + incr_buf = (char *)rxvt_realloc (incr_buf, incr_buf_size); } memcpy (incr_buf + incr_buf_fill, ct.value, ct.nitems); @@ -2911,11 +2950,11 @@ #if X_HAVE_UTF8_STRING selection_type = Sel_UTF8String; if (selection_request_other (xa[XA_UTF8_STRING], selnum)) - return; + return; #else selection_type = Sel_CompoundText; if (selection_request_other (xa[XA_COMPOUND_TEXT], selnum)) - return; + return; #endif } @@ -2953,16 +2992,28 @@ * EXT: SelectionClear */ void -rxvt_term::selection_clear () NOTHROW +rxvt_term::selection_clear (bool clipboard) NOTHROW { - want_refresh = 1; - free (selection.text); - selection.text = NULL; - selection.len = 0; - CLEAR_SELECTION (); + if (!clipboard) + { + want_refresh = 1; + free (selection.text); + selection.text = NULL; + selection.len = 0; + CLEAR_SELECTION (); + + if (display->selection_owner == this) + display->selection_owner = 0; + } + else + { + free (selection.clip_text); + selection.clip_text = NULL; + selection.clip_len = 0; - if (display->selection_owner == this) - display->selection_owner = 0; + if (display->clipboard_owner == this) + display->clipboard_owner = 0; + } } /* ------------------------------------------------------------------------- */ @@ -2973,7 +3024,7 @@ void rxvt_term::selection_make (Time tm) { - int i; + int size; wchar_t *new_selection_text; text_t *t; @@ -2999,8 +3050,8 @@ if (HOOK_INVOKE ((this, HOOK_SEL_MAKE, DT_LONG, (long)tm, DT_END))) return; - i = (selection.end.row - selection.beg.row + 1) * (ncol + 1); - new_selection_text = (wchar_t *)rxvt_malloc ((i + 4) * sizeof (wchar_t)); + size = (selection.end.row - selection.beg.row + 1) * (ncol + 1); + new_selection_text = (wchar_t *)rxvt_malloc ((size + 4) * sizeof (wchar_t)); int ofs = 0; int extra = 0; @@ -3016,7 +3067,7 @@ if (selection.rect) { col = selection.beg.col; - end_col = ncol + 1; + end_col = selection.end.col; } else #endif @@ -3024,11 +3075,7 @@ col = max (col, 0); - if (row == selection.end.row -#if !ENABLE_MINIMAL - || selection.rect -#endif - ) + if (row == selection.end.row) min_it (end_col, selection.end.col); t = ROW(row).t + col; @@ -3046,9 +3093,9 @@ if (extra < 0) { - extra += i; - i += i; - new_selection_text = (wchar_t *)rxvt_realloc (new_selection_text, (i + 4) * sizeof (wchar_t)); + extra += size; + size += size; + new_selection_text = (wchar_t *)rxvt_realloc (new_selection_text, (size + 4) * sizeof (wchar_t)); } ofs += rxvt_composite.expand (*t++, new_selection_text + ofs); @@ -3070,13 +3117,12 @@ } else #endif - if (!ROW(row).is_longer () && row != selection.end.row) + if (!ROW(row).is_longer () + && (row != selection.end.row || end_col != selection.end.col) + && (row != selection.beg.row || selection.beg.col < ncol)) new_selection_text[ofs++] = C0_LF; } - if (end_col != selection.end.col) - new_selection_text[ofs++] = C0_LF; - new_selection_text[ofs] = 0; if (ofs == 0) @@ -3098,19 +3144,30 @@ } bool -rxvt_term::selection_grab (Time tm) NOTHROW +rxvt_term::selection_grab (Time tm, bool clipboard) NOTHROW { - selection_time = tm; + Atom sel; + + if (!clipboard) + { + selection_time = tm; + sel = XA_PRIMARY; + } + else + { + clipboard_time = tm; + sel = xa[XA_CLIPBOARD]; + } - XSetSelectionOwner (dpy, XA_PRIMARY, vt, tm); - if (XGetSelectionOwner (dpy, XA_PRIMARY) == vt) + XSetSelectionOwner (dpy, sel, vt, tm); + if (XGetSelectionOwner (dpy, sel) == vt) { - display->set_selection_owner (this); + display->set_selection_owner (this, clipboard); return true; } else { - selection_clear (); + selection_clear (clipboard); return false; } @@ -3615,12 +3672,18 @@ /* TODO: Handle MULTIPLE */ } #endif - else if (rq.target == xa[XA_TIMESTAMP] && selection.text) + else if (rq.target == xa[XA_TIMESTAMP] && rq.selection == XA_PRIMARY && selection.text) { XChangeProperty (dpy, rq.requestor, rq.property, rq.target, 32, PropModeReplace, (unsigned char *)&selection_time, 1); ev.property = rq.property; } + else if (rq.target == xa[XA_TIMESTAMP] && rq.selection == xa[XA_CLIPBOARD] && selection.clip_text) + { + XChangeProperty (dpy, rq.requestor, rq.property, rq.target, + 32, PropModeReplace, (unsigned char *)&clipboard_time, 1); + ev.property = rq.property; + } else if (rq.target == XA_STRING || rq.target == xa[XA_TEXT] || rq.target == xa[XA_COMPOUND_TEXT] @@ -3661,11 +3724,16 @@ style = enc_compound_text; } - if (selection.text) + if (rq.selection == XA_PRIMARY && selection.text) { cl = selection.text; selectlen = selection.len; } + else if (rq.selection == xa[XA_CLIPBOARD] && selection.clip_text) + { + cl = selection.clip_text; + selectlen = selection.clip_len; + } else { cl = L""; @@ -3742,16 +3810,16 @@ x -= 1; clamp_it (x, 0, ncol - w); y -= 1; clamp_it (y, 0, nrow - h); - ov_x = x; ov_y = y; - ov_w = w; ov_h = h; + ov.x = x; ov.y = y; + ov.w = w; ov.h = h; - ov_text = new text_t *[h]; - ov_rend = new rend_t *[h]; + ov.text = new text_t *[h]; + ov.rend = new rend_t *[h]; for (y = 0; y < h; y++) { - text_t *tp = ov_text[y] = new text_t[w]; - rend_t *rp = ov_rend[y] = new rend_t[w]; + text_t *tp = ov.text[y] = new text_t[w]; + rend_t *rp = ov.rend[y] = new rend_t[w]; text_t t0, t1, t2; rend_t r = OVERLAY_RSTYLE; @@ -3780,31 +3848,31 @@ void rxvt_term::scr_overlay_off () NOTHROW { - if (!ov_text) + if (!ov.text) return; want_refresh = 1; - for (int y = 0; y < ov_h; y++) + for (int y = 0; y < ov.h; y++) { - delete [] ov_text[y]; - delete [] ov_rend[y]; + delete [] ov.text[y]; + delete [] ov.rend[y]; } - delete [] ov_text; ov_text = 0; - delete [] ov_rend; ov_rend = 0; + delete [] ov.text; ov.text = 0; + delete [] ov.rend; ov.rend = 0; } void rxvt_term::scr_overlay_set (int x, int y, text_t text, rend_t rend) NOTHROW { - if (!ov_text || x >= ov_w - 2 || y >= ov_h - 2) + if (!ov.text || x >= ov.w - 2 || y >= ov.h - 2) return; x++, y++; - ov_text[y][x] = text; - ov_rend[y][x] = rend; + ov.text[y][x] = text; + ov.rend[y][x] = rend; } void @@ -3833,19 +3901,24 @@ void rxvt_term::scr_swap_overlay () NOTHROW { - if (!ov_text) + if (!ov.text) return; + // hide cursor if it is within the overlay area + if (IN_RANGE_EXC (screen.cur.col - ov.x, 0, ov.w) + && IN_RANGE_EXC (screen.cur.row - ov.y, 0, ov.h)) + screen.flags &= ~Screen_VisibleCursor; + // swap screen mem with overlay - for (int y = ov_h; y--; ) + for (int y = ov.h; y--; ) { - text_t *t1 = ov_text[y]; - rend_t *r1 = ov_rend[y]; + text_t *t1 = ov.text[y]; + rend_t *r1 = ov.rend[y]; - text_t *t2 = ROW(y + ov_y + view_start).t + ov_x; - rend_t *r2 = ROW(y + ov_y + view_start).r + ov_x; + text_t *t2 = ROW(y + ov.y + view_start).t + ov.x; + rend_t *r2 = ROW(y + ov.y + view_start).r + ov.x; - for (int x = ov_w; x--; ) + for (int x = ov.w; x--; ) { text_t t = *t1; *t1++ = *t2; *t2++ = t; rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, FONTSET (r)->find_font (t));