--- rxvt-unicode/src/screen.C 2011/11/02 10:53:12 1.396 +++ rxvt-unicode/src/screen.C 2012/01/18 12:26:59 1.412 @@ -551,7 +551,12 @@ want_refresh = 1; view_start = 0; - selection_check (2); /* check for boundary cross */ + /* check for boundary cross */ + row_col_t pos; + pos.row = pos.col = 0; + if (ROWCOL_IS_BEFORE (selection.beg, pos) + && ROWCOL_IS_AFTER (selection.end, pos)) + CLEAR_SELECTION (); current_screen = scrn; @@ -684,7 +689,8 @@ } // move and/or clear selection, if any - if (selection.op && current_screen == selection.screen) + if (selection.op && current_screen == selection.screen + && selection.beg.row <= row2) { selection.beg.row -= count; selection.end.row -= count; @@ -776,7 +782,7 @@ if (len <= 0) /* sanity */ return; - unsigned char checksel; + bool checksel; unicode_t c; int ncol = this->ncol; const wchar_t *strend = str + len; @@ -1308,7 +1314,7 @@ /* ------------------------------------------------------------------------- */ /* - * Erase part of whole of the screen + * Erase part or whole of the screen * XTERM_SEQ: Clear screen after cursor : ESC [ 0 J * XTERM_SEQ: Clear screen before cursor: ESC [ 1 J * XTERM_SEQ: Clear whole screen : ESC [ 2 J @@ -1327,19 +1333,16 @@ switch (mode) { case 0: /* erase to end of screen */ - selection_check (1); scr_erase_line (0); row = screen.cur.row + 1; /* possible OOB */ num = nrow - row; break; case 1: /* erase to beginning of screen */ - selection_check (3); scr_erase_line (1); row = 0; num = screen.cur.row; break; case 2: /* erase whole screen */ - selection_check (3); row = 0; num = nrow; break; @@ -1366,7 +1369,7 @@ if (mapped) XClearArea (dpy, vt, 0, - Row2Pixel (row - view_start), (unsigned int)width, + Row2Pixel (row - view_start), (unsigned int)vt_width, (unsigned int)Height2Pixel (num), False); } else @@ -1379,7 +1382,7 @@ XChangeGC (dpy, gc, GCForeground, &gcvalue); XFillRectangle (dpy, vt, gc, 0, Row2Pixel (row - view_start), - (unsigned int)width, + (unsigned int)vt_width, (unsigned int)Height2Pixel (num)); gcvalue.foreground = pix_colors[Color_fg]; XChangeGC (dpy, gc, GCForeground, &gcvalue); @@ -1420,7 +1423,11 @@ ZERO_SCROLLBACK (); num_scr_allow = 0; - selection_check (3); + + row_col_t pos; + pos.row = pos.col = 0; + if (ROWCOL_IS_AFTER (selection.end, pos)) + CLEAR_SELECTION (); fs = SET_FONT (rstyle, FONTSET (rstyle)->find_font ('E')); for (int row = nrow; row--; ) @@ -1871,7 +1878,7 @@ void rxvt_term::scr_touch (bool refresh) NOTHROW { - scr_expose (0, 0, width, height, refresh); + scr_expose (0, 0, vt_width, vt_height, refresh); } /* ------------------------------------------------------------------------- */ @@ -2043,7 +2050,7 @@ refresh_count = 0; unsigned int old_screen_flags = screen.flags; - char have_bg = 0; + bool have_bg = 0; #ifdef HAVE_BG_PIXMAP have_bg = bg_pixmap != None; #endif @@ -2059,13 +2066,13 @@ scr_swap_overlay (); #endif - char showcursor = screen.flags & Screen_VisibleCursor; + bool showcursor = screen.flags & Screen_VisibleCursor; /* * C: set the cursor character (s) */ { - unsigned char setoldcursor; + bool setoldcursor; #ifdef CURSOR_BLINK if (hidden_cursor) @@ -2162,7 +2169,6 @@ int i = num_scr; int j; int len, wlen; - dLocal (int, num_scr); j = nrow; wlen = len = -1; @@ -2663,26 +2669,8 @@ void rxvt_term::scr_dump (int fd) NOTHROW { - int row, wrote; - unsigned int width, towrite; - const char r1[] = "\n"; - - for (row = saveLines + top_row; - row < saveLines + nrow - 1; row++) - { - width = row_buf[row].l >= 0 ? row_buf[row].l - : ncol; - for (towrite = width; towrite; towrite -= wrote) - { - wrote = write (fd, & (row_buf[row].t[width - towrite]), - towrite); - if (wrote < 0) - return; /* XXX: death, no report */ - } - if (row_buf[row].l >= 0) - if (write (fd, r1, 1) <= 0) - return; /* XXX: death, no report */ - } + // if this method is needed, it can be implemented by factoring the + // relevant code in scr_printscreen } #endif @@ -2692,27 +2680,16 @@ void rxvt_term::selection_check (int check_more) NOTHROW { - row_col_t pos; - if (!selection.op) return; - pos.row = pos.col = 0; if (!IN_RANGE_EXC (selection.beg.row, top_row, nrow) || !IN_RANGE_EXC (selection.mark.row, top_row, nrow) || !IN_RANGE_EXC (selection.end.row, top_row, nrow) || (check_more == 1 && current_screen == selection.screen && !ROWCOL_IS_BEFORE (screen.cur, selection.beg) - && ROWCOL_IS_BEFORE (screen.cur, selection.end)) - || (check_more == 2 - && ROWCOL_IS_BEFORE (selection.beg, pos) - && ROWCOL_IS_AFTER (selection.end, pos)) - || (check_more == 3 - && ROWCOL_IS_AFTER (selection.end, pos)) - || (check_more == 4 /* screen width change */ - && (selection.beg.row != selection.end.row - || selection.end.col > ncol))) + && ROWCOL_IS_BEFORE (screen.cur, selection.end))) CLEAR_ALL_SELECTION (); } @@ -2729,12 +2706,12 @@ data[i] = C0_CR; if (priv_modes & PrivMode_BracketPaste) - tt_printf ("\e[200~"); + tt_printf ("\x1b[200~"); tt_write (data, len); if (priv_modes & PrivMode_BracketPaste) - tt_printf ("\e[201~"); + tt_printf ("\x1b[201~"); } void