--- rxvt-unicode/src/screen.C 2004/03/28 02:07:08 1.66 +++ rxvt-unicode/src/screen.C 2004/08/08 16:43:21 1.85 @@ -1,5 +1,5 @@ /*--------------------------------*-C-*--------------------------------------* - * File: screen.c + * File: screen.C *---------------------------------------------------------------------------* * * Copyright (c) 1997-2001 Geoff Wing @@ -31,7 +31,7 @@ #include /* get the typedef for CARD32 */ -#include +#include #include #include "salloc.C" // HACK, should be a seperate compile! @@ -50,41 +50,41 @@ * GENERAL SCREEN AND SELECTION UPDATE ROUTINES * * ------------------------------------------------------------------------- */ #define ZERO_SCROLLBACK() \ - if ((Options & Opt_scrollTtyOutput) == Opt_scrollTtyOutput) \ + if (Options & Opt_scrollTtyOutput) \ TermWin.view_start = 0 #define CLEAR_SELECTION() \ - selection.beg.row = selection.beg.col \ + selection.beg.row = selection.beg.col \ = selection.end.row = selection.end.col = 0 #define CLEAR_ALL_SELECTION() \ - selection.beg.row = selection.beg.col \ - = selection.mark.row = selection.mark.col \ + selection.beg.row = selection.beg.col \ + = selection.mark.row = selection.mark.col \ = selection.end.row = selection.end.col = 0 -#define ROW_AND_COL_IS_AFTER(A, B, C, D) \ +#define ROW_AND_COL_IS_AFTER(A, B, C, D) \ (((A) > (C)) || (((A) == (C)) && ((B) > (D)))) -#define ROW_AND_COL_IS_BEFORE(A, B, C, D) \ +#define ROW_AND_COL_IS_BEFORE(A, B, C, D) \ (((A) < (C)) || (((A) == (C)) && ((B) < (D)))) -#define ROW_AND_COL_IN_ROW_AFTER(A, B, C, D) \ +#define ROW_AND_COL_IN_ROW_AFTER(A, B, C, D) \ (((A) == (C)) && ((B) > (D))) -#define ROW_AND_COL_IN_ROW_AT_OR_AFTER(A, B, C, D) \ +#define ROW_AND_COL_IN_ROW_AT_OR_AFTER(A, B, C, D) \ (((A) == (C)) && ((B) >= (D))) -#define ROW_AND_COL_IN_ROW_BEFORE(A, B, C, D) \ +#define ROW_AND_COL_IN_ROW_BEFORE(A, B, C, D) \ (((A) == (C)) && ((B) < (D))) -#define ROW_AND_COL_IN_ROW_AT_OR_BEFORE(A, B, C, D) \ +#define ROW_AND_COL_IN_ROW_AT_OR_BEFORE(A, B, C, D) \ (((A) == (C)) && ((B) <= (D))) /* these must be row_col_t */ -#define ROWCOL_IS_AFTER(X, Y) \ +#define ROWCOL_IS_AFTER(X, Y) \ ROW_AND_COL_IS_AFTER ((X).row, (X).col, (Y).row, (Y).col) -#define ROWCOL_IS_BEFORE(X, Y) \ +#define ROWCOL_IS_BEFORE(X, Y) \ ROW_AND_COL_IS_BEFORE ((X).row, (X).col, (Y).row, (Y).col) -#define ROWCOL_IN_ROW_AFTER(X, Y) \ +#define ROWCOL_IN_ROW_AFTER(X, Y) \ ROW_AND_COL_IN_ROW_AFTER ((X).row, (X).col, (Y).row, (Y).col) -#define ROWCOL_IN_ROW_BEFORE(X, Y) \ +#define ROWCOL_IN_ROW_BEFORE(X, Y) \ ROW_AND_COL_IN_ROW_BEFORE ((X).row, (X).col, (Y).row, (Y).col) -#define ROWCOL_IN_ROW_AT_OR_AFTER(X, Y) \ +#define ROWCOL_IN_ROW_AT_OR_AFTER(X, Y) \ ROW_AND_COL_IN_ROW_AT_OR_AFTER ((X).row, (X).col, (Y).row, (Y).col) -#define ROWCOL_IN_ROW_AT_OR_BEFORE(X, Y) \ +#define ROWCOL_IN_ROW_AT_OR_BEFORE(X, Y) \ ROW_AND_COL_IN_ROW_AT_OR_BEFORE ((X).row, (X).col, (Y).row, (Y).col) /* @@ -94,22 +94,22 @@ */ #define drawBuffer TermWin.vt -#define CLEAR_ROWS(row, num) \ - if (TermWin.mapped) \ - XClearArea (display->display, drawBuffer, TermWin.int_bwidth, \ +#define CLEAR_ROWS(row, num) \ + if (TermWin.mapped) \ + XClearArea (display->display, drawBuffer, 0, \ Row2Pixel (row), (unsigned int)TermWin.width, \ (unsigned int)Height2Pixel (num), False) -#define CLEAR_CHARS(x, y, num) \ - if (TermWin.mapped) \ - XClearArea (display->display, drawBuffer, x, y, \ - (unsigned int)Width2Pixel (num), \ +#define CLEAR_CHARS(x, y, num) \ + if (TermWin.mapped) \ + XClearArea (display->display, drawBuffer, x, y, \ + (unsigned int)Width2Pixel (num), \ (unsigned int)Height2Pixel (1), False) -#define ERASE_ROWS(row, num) \ - XFillRectangle (display->display, drawBuffer, TermWin.gc, \ - TermWin.int_bwidth, Row2Pixel (row), \ - (unsigned int)TermWin.width, \ +#define ERASE_ROWS(row, num) \ + XFillRectangle (display->display, drawBuffer, TermWin.gc, \ + 0, Row2Pixel (row), \ + (unsigned int)TermWin.width, \ (unsigned int)Height2Pixel (num)) /* ------------------------------------------------------------------------- * @@ -120,7 +120,7 @@ rxvt_term::scr_blank_line (text_t *et, rend_t *er, unsigned int width, rend_t efs) { efs &= ~RS_baseattrMask; - efs = SET_FONT (efs, TermWin.fontset->find_font (' ')); + efs = SET_FONT (efs, TermWin.ascii_map [' ' - 0x20]); while (width--) { @@ -191,7 +191,7 @@ if (prev_nrow == 0) { /* - * first time called so just malloc everything : don't rely on realloc + * first time called so just malloc everything: don't rely on realloc * Note: this is still needed so that all the scrollback lines are NULL */ screen.text = (text_t **)rxvt_calloc (total_rows, sizeof (text_t *)); @@ -258,6 +258,7 @@ for (p = nrow; p < prev_nrow; p++) { q = p + TermWin.saveLines; + if (screen.text[q]) { #ifdef DEBUG_STRICT @@ -266,6 +267,7 @@ talloc->free (screen.text[q]); ralloc->free (screen.rend[q]); } + if (swap.text[p]) { #ifdef DEBUG_STRICT @@ -274,6 +276,7 @@ talloc->free (swap.text[p]); ralloc->free (swap.rend[p]); } + #ifdef DEBUG_STRICT assert (drawn_text[p] && drawn_rend[p]); #endif @@ -313,7 +316,7 @@ swap.rend[p] = NULL; drawn_text[p] = NULL; drawn_rend[p] = NULL; - scr_blank_screen_mem (swap.text, swap.rend, p, setrstyle); + scr_blank_screen_mem (swap.text, swap.rend, p, setrstyle); scr_blank_screen_mem (drawn_text, drawn_rend, p, setrstyle); } @@ -338,7 +341,6 @@ /* resize columns */ if (ncol != prev_ncol) { - int common = min (prev_ncol, ncol); rxvt_salloc *ta = new rxvt_salloc (ncol * sizeof (text_t)); rxvt_salloc *ra = new rxvt_salloc (ncol * sizeof (rend_t)); @@ -346,39 +348,38 @@ { if (screen.text[p]) { - text_t *t = (text_t *)ta->alloc (); memcpy (t, screen.text[p], common * sizeof (text_t)); screen.text[p] = t; - rend_t *r = (rend_t *)ra->alloc (); memcpy (r, screen.rend[p], common * sizeof (rend_t)); screen.rend[p] = r; + screen.text[p] = (text_t *)ta->alloc (screen.text[p], prev_ncol * sizeof (text_t)); + screen.rend[p] = (rend_t *)ra->alloc (screen.rend[p], prev_ncol * sizeof (rend_t)); MIN_IT (screen.tlen[p], (int16_t)ncol); if (ncol > prev_ncol) - scr_blank_line (& (screen.text[p][prev_ncol]), - & (screen.rend[p][prev_ncol]), - ncol - prev_ncol, - setrstyle); + scr_blank_line (&screen.text[p][prev_ncol], + &screen.rend[p][prev_ncol], + ncol - prev_ncol, setrstyle); } } for (p = 0; p < nrow; p++) { - text_t *t = (text_t *)ta->alloc (); memcpy (t, drawn_text[p], common * sizeof (text_t)); drawn_text[p] = t; - rend_t *r = (rend_t *)ra->alloc (); memcpy (r, drawn_rend[p], common * sizeof (rend_t)); drawn_rend[p] = r; + drawn_text[p] = (text_t *)ta->alloc (drawn_text[p], prev_ncol * sizeof (text_t)); + drawn_rend[p] = (rend_t *)ra->alloc (drawn_rend[p], prev_ncol * sizeof (rend_t)); if (ncol > prev_ncol) - scr_blank_line (& (drawn_text[p][prev_ncol]), - & (drawn_rend[p][prev_ncol]), + scr_blank_line (&drawn_text[p][prev_ncol], + &drawn_rend[p][prev_ncol], ncol - prev_ncol, setrstyle); if (swap.text[p]) { - text_t *t = (text_t *)ta->alloc (); memcpy (t, swap.text[p], common * sizeof (text_t)); swap.text[p] = t; - rend_t *r = (rend_t *)ra->alloc (); memcpy (r, swap.rend[p], common * sizeof (rend_t)); swap.rend[p] = r; + swap.text[p] = (text_t *)ta->alloc (swap.text[p], prev_ncol * sizeof (text_t)); + swap.rend[p] = (rend_t *)ra->alloc (swap.rend[p], prev_ncol * sizeof (rend_t)); MIN_IT (swap.tlen[p], (int16_t)ncol); if (ncol > prev_ncol) - scr_blank_line (& (swap.text[p][prev_ncol]), - & (swap.rend[p][prev_ncol]), + scr_blank_line (&swap.text[p][prev_ncol], + &swap.rend[p][prev_ncol], ncol - prev_ncol, setrstyle); } @@ -478,7 +479,7 @@ prev_nrow = prev_ncol = 0; scr_reset (); - scr_clear (); + scr_clear (true); scr_refresh (SLOW_REFRESH); } @@ -513,6 +514,7 @@ s->s_charset = s->charset; s->s_charset_char = charsets[s->charset]; break; + case RESTORE: want_refresh = 1; s->cur.row = s->s_cur.row; @@ -558,41 +560,43 @@ TermWin.view_start = 0; if (current_screen == scrn) - return current_screen; + return scrn; selection_check (2); /* check for boundary cross */ SWAP_IT (current_screen, scrn, int); #if NSCREENS - num_scr = 0; - offset = TermWin.saveLines; - for (i = prev_nrow; i--;) + if (Options & Opt_secondaryScreen) { - SWAP_IT (screen.text[i + offset], swap.text[i], text_t *); - SWAP_IT (screen.tlen[i + offset], swap.tlen[i], int16_t); - SWAP_IT (screen.rend[i + offset], swap.rend[i], rend_t *); - } - SWAP_IT (screen.cur.row, swap.cur.row, int16_t); - SWAP_IT (screen.cur.col, swap.cur.col, int16_t); + num_scr = 0; + offset = TermWin.saveLines; + for (i = prev_nrow; i--;) + { + SWAP_IT (screen.text[i + offset], swap.text[i], text_t *); + SWAP_IT (screen.tlen[i + offset], swap.tlen[i], int16_t); + SWAP_IT (screen.rend[i + offset], swap.rend[i], rend_t *); + } + SWAP_IT (screen.cur.row, swap.cur.row, int16_t); + SWAP_IT (screen.cur.col, swap.cur.col, int16_t); # ifdef DEBUG_STRICT - assert ((screen.cur.row >= 0) && (screen.cur.row < prev_nrow)); - assert ((screen.cur.col >= 0) && (screen.cur.col < prev_ncol)); + assert ((screen.cur.row >= 0) && (screen.cur.row < prev_nrow)); + assert ((screen.cur.col >= 0) && (screen.cur.col < prev_ncol)); # else /* drive with your eyes closed */ - MAX_IT (screen.cur.row, 0); - MIN_IT (screen.cur.row, (int32_t)prev_nrow - 1); - MAX_IT (screen.cur.col, 0); - MIN_IT (screen.cur.col, (int32_t)prev_ncol - 1); -# endif - SWAP_IT (screen.charset, swap.charset, int16_t); - SWAP_IT (screen.flags, swap.flags, int); - screen.flags |= Screen_VisibleCursor; - swap.flags |= Screen_VisibleCursor; -#else -# ifdef SCROLL_ON_NO_SECONDARY - if (current_screen == PRIMARY) - scr_scroll_text (0, (prev_nrow - 1), prev_nrow, 0); + MAX_IT (screen.cur.row, 0); + MIN_IT (screen.cur.row, (int32_t)prev_nrow - 1); + MAX_IT (screen.cur.col, 0); + MIN_IT (screen.cur.col, (int32_t)prev_ncol - 1); # endif + SWAP_IT (screen.charset, swap.charset, int16_t); + SWAP_IT (screen.flags, swap.flags, int); + screen.flags |= Screen_VisibleCursor; + swap.flags |= Screen_VisibleCursor; + } + else #endif + if (Options & Opt_secondaryScroll) + //if (current_screen == PRIMARY) + scr_scroll_text (0, (prev_nrow - 1), prev_nrow, 0); return scrn; } @@ -644,7 +648,8 @@ want_refresh = 1; D_SCREEN ((stderr, "rxvt_scroll_text (%d,%d,%d,%d): %s", row1, row2, count, spec, (current_screen == PRIMARY) ? "Primary" : "Secondary")); - if ((count > 0) && (row1 == 0) && (current_screen == PRIMARY)) + if (row1 == 0 && count > 0 + && (current_screen == PRIMARY || Options & Opt_secondaryScroll)) { nscrolled = (long)TermWin.nscrolled + (long)count; @@ -702,18 +707,15 @@ /* A: scroll up */ /* A1: Copy lines that will get clobbered by the rotation */ - for (i = 0, j = row1; i < count; i++, j++) - { - buf_text[i] = screen.text[j]; - buf_rend[i] = screen.rend[j]; - } + memcpy (buf_text, screen.text + row1, count * sizeof (text_t *)); + memcpy (buf_rend, screen.rend + row1, count * sizeof (rend_t *)); + /* A2: Rotate lines */ - for (j = row1, i = j + count; i <= row2; i++, j++) - { - screen.tlen[j] = screen.tlen[i]; - screen.text[j] = screen.text[i]; - screen.rend[j] = screen.rend[i]; - } + i = row2 - row1 - count + 1; + memmove (screen.tlen + row1, screen.tlen + row1 + count, i * sizeof (int16_t)); + memmove (screen.text + row1, screen.text + row1 + count, i * sizeof (text_t *)); + memmove (screen.rend + row1, screen.rend + row1 + count, i * sizeof (rend_t *)); + j = row2 - count + 1, i = count; } else /* if (j < 0) */ @@ -726,6 +728,7 @@ buf_text[i] = screen.text[j]; buf_rend[i] = screen.rend[j]; } + /* B2: Rotate lines */ for (j = row2, i = j - count; i >= row1; i--, j--) { @@ -733,21 +736,18 @@ screen.text[j] = screen.text[i]; screen.rend[j] = screen.rend[i]; } + j = row1, i = count; count = -count; } /* C: Resurrect lines */ - for (; i--; j++) - { - screen.tlen[j] = 0; - screen.text[j] = buf_text[i]; - screen.rend[j] = buf_rend[i]; - - if (!spec) /* line length may not equal TermWin.ncol */ - scr_blank_screen_mem (screen.text, screen.rend, - (unsigned int)j, rstyle); - } + memset (screen.tlen + j, 0, i * sizeof (int16_t)); + memcpy (screen.text + j, buf_text, i * sizeof (text_t *)); + memcpy (screen.rend + j, buf_rend, i * sizeof (text_t *)); + if (!spec) /* line length may not equal TermWin.ncol */ + for (; i--; j++) + scr_blank_screen_mem (screen.text, screen.rend, (unsigned int)j, rstyle); return count; } @@ -775,7 +775,7 @@ ZERO_SCROLLBACK (); if (nlines > 0) { - nlines += (screen.cur.row - screen.bscroll); + nlines += screen.cur.row - screen.bscroll; if ((nlines > 0) && (screen.tscroll == 0) && (screen.bscroll == (TermWin.nrow - 1))) @@ -788,7 +788,7 @@ #ifdef DEBUG_STRICT assert (screen.cur.col < last_col); assert ((screen.cur.row < TermWin.nrow) - && (screen.cur.row >= - (int32_t)TermWin.nscrolled)); + && (screen.cur.row >= - (int32_t)TermWin.nscrolled)); #else /* drive with your eyes closed */ MIN_IT (screen.cur.col, last_col - 1); MIN_IT (screen.cur.row, (int32_t)TermWin.nrow - 1); @@ -809,11 +809,11 @@ if (c < 0x20) switch (c) { - case '\t': + case C0_HT: scr_tab (1); continue; - case '\n': + case C0_LF: if (screen.tlen[row] != -1) /* XXX: think about this */ MAX_IT (screen.tlen[row], screen.cur.col); @@ -828,7 +828,7 @@ srp = screen.rend[row]; /* _must_ refresh */ continue; - case '\r': + case C0_CR: if (screen.tlen[row] != -1) /* XXX: think about this */ MAX_IT (screen.tlen[row], screen.cur.col); @@ -865,7 +865,7 @@ // rely on wcwidth to tell us the character width, at least for non-latin1 // do wcwidth before further replacements, as wcwidth says that line-drawing // characters have width -1 (DOH!) on GNU/Linux sometimes. - int width = c < 256 ? 1 : wcwidth (c); + int width = c < 0x100 ? 1 : wcwidth (c); if (charsets[screen.charset] == '0') // DEC SPECIAL { @@ -884,14 +884,18 @@ } } - if (width > 0) + if (width != 0) { #if !UNICODE_3 && ENABLE_COMBINING // trim characters we can't store directly :( if (c >= 0x10000) c = rxvt_composite.compose (c); // map to lower 16 bits #endif - rend_t rend = SET_FONT (rstyle, TermWin.fontset->find_font (c)); + bool bold = (Options & Opt_realBold) && ((rstyle & RS_Bold) != 0); + rend_t rend = SET_FONT (rstyle, + c > 0x7f || bold || c < 0x20 + ? TermWin.fontset->find_font (c, bold) + : TermWin.ascii_map [c - 0x20]); do { @@ -986,6 +990,7 @@ rxvt_term::scr_backspace () { want_refresh = 1; + if (screen.cur.col == 0) { if (screen.cur.row > 0) @@ -1000,6 +1005,7 @@ } else if ((screen.flags & Screen_WrapNext) == 0) scr_gotorc (0, -1, RELATIVE); + screen.flags &= ~Screen_WrapNext; } @@ -1113,8 +1119,7 @@ D_SCREEN ((stderr, "rxvt_scr_gotorc (r:%s%d,c:%s%d): from (r:%d,c:%d)", (relative & R_RELATIVE ? "+" : ""), row, (relative & C_RELATIVE ? "+" : ""), col, screen.cur.row, screen.cur.col)); - screen.cur.col = ((relative & C_RELATIVE) ? (screen.cur.col + col) - : col); + screen.cur.col = relative & C_RELATIVE ? screen.cur.col + col : col; MAX_IT (screen.cur.col, 0); MIN_IT (screen.cur.col, (int32_t)TermWin.ncol - 1); @@ -1163,7 +1168,7 @@ void rxvt_term::scr_index (enum page_dirn direction) { - int dirn; + int dirn; want_refresh = 1; dirn = ((direction == UP) ? 1 : -1); @@ -1233,8 +1238,7 @@ } if (screen.text[row]) - scr_blank_line (& (screen.text[row][col]), - & (screen.rend[row][col]), num, rstyle); + scr_blank_line (&screen.text[row][col], &screen.rend[row][col], num, rstyle); else scr_blank_screen_mem (screen.text, screen.rend, row, rstyle); } @@ -1282,8 +1286,6 @@ return; } - refresh_type |= REFRESH_BOUNDS; - if (selection.op && current_screen == selection.screen && ((selection.beg.row >= row && selection.beg.row <= row + num) || (selection.end.row >= row @@ -1516,6 +1518,7 @@ rxvt_term::scr_cursor_visible (int mode) { want_refresh = 1; + if (mode) screen.flags |= Screen_VisibleCursor; else @@ -1739,10 +1742,18 @@ if (drawn_text == NULL) /* sanity check */ return; +#ifndef NO_SLOW_LINK_SUPPORT + if (refresh_type == FAST_REFRESH && !display->is_local) + { + y = 0; + height = TermWin.height; + } +#endif + #ifdef DEBUG_STRICT - x = max (x, (int)TermWin.int_bwidth); + x = max (x, 0); x = min (x, (int)TermWin.width); - y = max (y, (int)TermWin.int_bwidth); + y = max (y, 0); y = min (y, (int)TermWin.height); #endif @@ -1763,11 +1774,10 @@ D_SCREEN ((stderr, "rxvt_scr_expose (x:%d, y:%d, w:%d, h:%d) area (c:%d,r:%d)- (c:%d,r:%d)", x, y, width, height, rc[PART_BEG].col, rc[PART_BEG].row, rc[PART_END].col, rc[PART_END].row)); for (i = rc[PART_BEG].row; i <= rc[PART_END].row; i++) - fill_text (& (drawn_text[i][rc[PART_BEG].col]), 0, - (rc[PART_END].col - rc[PART_BEG].col + 1)); + fill_text (&drawn_text[i][rc[PART_BEG].col], 0, rc[PART_END].col - rc[PART_BEG].col + 1); if (refresh) - scr_refresh (SLOW_REFRESH | REFRESH_BOUNDS); + scr_refresh (SLOW_REFRESH); } /* ------------------------------------------------------------------------- */ @@ -1812,8 +1822,8 @@ int rxvt_term::scr_page (enum page_dirn direction, int nlines) { - int n; - uint16_t oldviewstart; + int n; + uint16_t oldviewstart; D_SCREEN ((stderr, "rxvt_scr_page (%s, %d) view_start:%d", ((direction == UP) ? "UP" : "DN"), nlines, TermWin.view_start)); #ifdef DEBUG_STRICT @@ -1841,6 +1851,7 @@ want_refresh = 1; num_scr -= (TermWin.view_start - oldviewstart); } + return (int) (TermWin.view_start - oldviewstart); } @@ -1918,9 +1929,7 @@ void rxvt_term::scr_refresh (unsigned char refresh_type) { - unsigned char clearfirst, /* first character writes before cell */ - clearlast, /* last character writes beyond cell */ - must_clear, /* use draw_string not draw_image_string */ + unsigned char must_clear, /* use draw_string not draw_image_string */ rvid, /* reverse video this position */ showcursor; /* show the cursor */ int16_t col, row, /* column/row we're processing */ @@ -1939,18 +1948,12 @@ /* * A: set up vars */ - clearfirst = clearlast = must_clear = 0; + must_clear = 0; refresh_count = 0; row_offset = TermWin.saveLines - TermWin.view_start; - if ((refresh_type & REFRESH_BOUNDS)) - { - clearfirst = clearlast = 1; - refresh_type &= ~REFRESH_BOUNDS; - } - #ifdef XPM_BACKGROUND must_clear |= (bgPixmap.pixmap != None); #endif @@ -2047,7 +2050,8 @@ * This has been deliberately kept simple. */ i = num_scr; - if (refresh_type == FAST_REFRESH && num_scr_allow && i + if (!display->is_local + && refresh_type == FAST_REFRESH && num_scr_allow && i && abs (i) < TermWin.nrow && !must_clear) { int16_t nits; @@ -2199,7 +2203,7 @@ rvid = !!(rend & RS_RVid); #ifndef NO_BOLD_UNDERLINE_REVERSE - if (rend & RS_Bold && fore == Color_fg) + if (rend & RS_Bold && fore == Color_fg && !(Options & Opt_realBold)) { if (ISSET_PIXCOLOR (Color_BD)) fore = Color_BD; @@ -2227,7 +2231,7 @@ } #ifdef TEXT_BLINK - if (rend & RS_Blink && back == Color_bg) + if (rend & RS_Blink && (back == Color_bg || fore == Color_bg)) { if (!text_blink_ev.active) { @@ -2267,7 +2271,7 @@ else font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, back); - if ((rend & RS_Uline) && (font->descent > 1)) + if (rend & RS_Uline && font->descent > 1 && fore != back) XDrawLine (display->display, drawBuffer, TermWin.gc, xpixel, ypixel + font->ascent + 1, xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1); @@ -2312,30 +2316,8 @@ */ scr_reverse_selection (); - /* - * I: other general cleanup - */ - if (clearfirst && TermWin.int_bwidth) - /* - * clear the whole screen height, note that width == 0 is treated - * specially by XClearArea - */ - XClearArea (display->display, TermWin.vt, 0, 0, - (unsigned int)TermWin.int_bwidth, - (unsigned int)TermWin_TotalHeight (), False); - - if (clearlast && TermWin.int_bwidth) - /* - * clear the whole screen height, note that width == 0 is treated - * specially by XClearArea - */ - XClearArea (display->display, TermWin.vt, - TermWin.width + TermWin.int_bwidth, 0, - (unsigned int)TermWin.int_bwidth, - (unsigned int)TermWin_TotalHeight (), False); - if (refresh_type & SMOOTH_REFRESH) - XSync (display->display, False); + XFlush (display->display); num_scr = 0; num_scr_allow = 1; @@ -2516,8 +2498,8 @@ MEMCPY (ds, data + i, n); for (j = 0; j < n; j++) - if (ds[j] == '\n') - ds[j] = '\r'; + if (ds[j] == C0_LF) + ds[j] = C0_CR; tt_write (ds, (int)n); } @@ -2608,8 +2590,7 @@ char **cl; int cr; - if (XmbTextPropertyToTextList (display->display, &ct, &cl, - &cr) >= 0 && cl) + if (XmbTextPropertyToTextList (display->display, &ct, &cl, &cr) >= 0 && cl) { for (int i = 0; i < cr; i++) paste ((unsigned char *)cl[i], STRLEN (cl[i])); @@ -2878,11 +2859,11 @@ } if (screen.tlen[row] != -1 && row != end_row) - new_selection_text[ofs++] = L'\n'; + new_selection_text[ofs++] = C0_LF; } if (end_col != selection.end.col) - new_selection_text[ofs++] = L'\n'; + new_selection_text[ofs++] = C0_LF; new_selection_text[ofs] = 0; @@ -3119,9 +3100,9 @@ void rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int buttonpress, int clickchange) { - int16_t ncol = TermWin.ncol; - int end_col; - row_col_t pos; + int16_t ncol = TermWin.ncol; + int end_col; + row_col_t pos; enum { LEFT, RIGHT } closeto = RIGHT; @@ -3514,50 +3495,3 @@ #endif /* ------------------------------------------------------------------------- */ - -/* ------------------------------------------------------------------------- * - * DEBUG ROUTINES * - * ------------------------------------------------------------------------- */ -#if 0 -void -rxvt_debug_colors (void) -{ - int color; - const char *name[] = - { - "fg", "bg", - "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white" - }; - - fprintf (stderr, "Color ( "); - if (rstyle & RS_RVid) - fprintf (stderr, "rvid "); - if (rstyle & RS_Bold) - fprintf (stderr, "bold "); - if (rstyle & RS_Blink) - fprintf (stderr, "blink "); - if (rstyle & RS_Uline) - fprintf (stderr, "uline "); - fprintf (stderr, "): "); - - color = GET_FGCOLOR (rstyle); -#ifndef NO_BRIGHTCOLOR - if (color >= minBrightCOLOR && color <= maxBrightCOLOR) - { - color -= (minBrightCOLOR - minCOLOR); - fprintf (stderr, "bright "); - } -#endif - fprintf (stderr, "%s on ", name[color]); - - color = GET_BGCOLOR (rstyle); -#ifndef NO_BRIGHTCOLOR - if (color >= minBrightCOLOR && color <= maxBrightCOLOR) - { - color -= (minBrightCOLOR - minCOLOR); - fprintf (stderr, "bright "); - } -#endif - fprintf (stderr, "%s\n", name[color]); -} -#endif