--- rxvt-unicode/src/screen.C 2010/10/15 21:13:44 1.353 +++ rxvt-unicode/src/screen.C 2011/01/04 18:22:11 1.358 @@ -919,9 +919,9 @@ } // nuke the character at this position, if required - // due to wonderful coincidents everywehere else in this loop + // due to wonderful coincidences everywhere else in this loop // we never have to check for overwriting a wide char itself, - // only it's tail. + // only its tail. if (expect_false (line->t[screen.cur.col] == NOCHAR)) scr_kill_char (*line, screen.cur.col); @@ -2629,7 +2629,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++) @@ -3000,7 +3000,7 @@ void rxvt_term::selection_make (Time tm) { - int i; + int size; wchar_t *new_selection_text; text_t *t; @@ -3026,8 +3026,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; @@ -3073,9 +3073,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); @@ -3097,7 +3097,8 @@ } else #endif - if (!ROW(row).is_longer () && row != selection.end.row) + if (!ROW(row).is_longer () && row != selection.end.row + && (row != selection.beg.row || selection.beg.col < ncol)) new_selection_text[ofs++] = C0_LF; }