--- rxvt-unicode/src/screen.C 2011/11/01 00:04:46 1.395 +++ rxvt-unicode/src/screen.C 2011/11/15 20:09:13 1.405 @@ -684,19 +684,14 @@ } // 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; selection.mark.row -= count; - if (selection.beg.row < top_row - || selection.end.row < top_row - || selection.mark.row < top_row) - { - CLEAR_ALL_SELECTION (); - selection.op = SELECTION_CLEAR; - } + selection_check (0); } // finally move the view window, if desired @@ -782,7 +777,7 @@ if (len <= 0) /* sanity */ return; - unsigned char checksel; + bool checksel; unicode_t c; int ncol = this->ncol; const wchar_t *strend = str + len; @@ -2049,7 +2044,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 @@ -2065,13 +2060,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) @@ -2698,12 +2693,12 @@ void rxvt_term::selection_check (int check_more) NOTHROW { - row_col_t pos; - if (!selection.op) return; + row_col_t pos; 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) @@ -2715,10 +2710,7 @@ && 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_AFTER (selection.end, pos))) CLEAR_ALL_SELECTION (); }