--- rxvt-unicode/src/screen.C 2004/12/13 06:44:18 1.149 +++ rxvt-unicode/src/screen.C 2005/02/13 08:56:28 1.157 @@ -30,7 +30,6 @@ #include /* get the typedef for CARD32 */ #include -#include #include "salloc.C" // HACK, should be a seperate compile! @@ -296,7 +295,6 @@ /* we have fewer rows so fix up cursor position */ MIN_IT (screen.cur.row, (int32_t)nrow - 1); - MIN_IT (swap.cur.row, (int32_t)nrow - 1); scr_reset_realloc (); /* realloc _last_ */ } @@ -337,13 +335,11 @@ screen.s_cur.row += k; TermWin.nscrolled -= k; } + #ifdef DEBUG_STRICT assert (screen.cur.row < TermWin.nrow); - assert (swap.cur.row < TermWin.nrow); #else /* drive with your eyes closed */ - MIN_IT (screen.cur.row, nrow - 1); - MIN_IT (swap.cur.row, nrow - 1); #endif TermWin.ncol = ncol; // save b/c scr_blank_screen_mem uses this } @@ -396,7 +392,6 @@ } MIN_IT (screen.cur.col, (int16_t)ncol - 1); - MIN_IT (swap.cur.col, (int16_t)ncol - 1); delete talloc; talloc = ta; delete ralloc; ralloc = ra; @@ -568,19 +563,14 @@ selection_check (2); /* check for boundary cross */ - SWAP_IT (current_screen, scrn, int); + i = current_screen; current_screen = scrn; scrn = i; 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); -# 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 #if NSCREENS if (options & Opt_secondaryScreen) @@ -2402,7 +2392,13 @@ if (rend & RS_Uline && font->descent > 1 && fore != back) { - XSetForeground (display->display, TermWin.gc, pix_colors[fore]); +#if ENABLE_FRILLS + if (ISSET_PIXCOLOR (Color_underline)) + XSetForeground (display->display, TermWin.gc, pix_colors[Color_underline]); + else +#endif + XSetForeground (display->display, TermWin.gc, pix_colors[fore]); + XDrawLine (display->display, drawBuffer, TermWin.gc, xpixel, ypixel + font->ascent + 1, xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1); @@ -2658,25 +2654,14 @@ * Paste a selection direct to the command fd */ void -rxvt_term::paste (const unsigned char *data, unsigned int len) +rxvt_term::paste (unsigned char *data, unsigned int len) { - unsigned int i, j, n; - unsigned char *ds = (unsigned char *)rxvt_malloc (PASTE_SIZE); - /* convert normal newline chars into common keyboard Return key sequence */ - for (i = 0; i < len; i += PASTE_SIZE) - { - n = min (len - i, PASTE_SIZE); - memcpy (ds, data + i, n); - - for (j = 0; j < n; j++) - if (ds[j] == C0_LF) - ds[j] = C0_CR; + for (unsigned int i = 0; i < len; i++) + if (data[i] == C0_LF) + data[i] = C0_CR; - tt_write (ds, (int)n); - } - - free (ds); + tt_write (data, len); } /* ------------------------------------------------------------------------- */ @@ -3425,7 +3410,7 @@ else if (selection.clicks == 3) { #if ENABLE_FRILLS - if ((options & Opt_tripleclickwords)) + if (options & Opt_tripleclickwords) { int end_row; @@ -3453,6 +3438,15 @@ selection.beg.col = 0; selection.end.col = ncol; + + // select a complete logical line + while (selection.beg.row > -TermWin.saveLines + && screen.tlen[selection.beg.row - 1 + TermWin.saveLines] == -1) + selection.beg.row--; + + while (selection.end.row < TermWin.nrow + && screen.tlen[selection.end.row + TermWin.saveLines] == -1) + selection.end.row++; } } @@ -3542,6 +3536,7 @@ rxvt_term::selection_send (const XSelectionRequestEvent &rq) { XSelectionEvent ev; + dDisp; ev.type = SelectionNotify; ev.property = None; @@ -3565,7 +3560,7 @@ *target++ = xa[XA_UTF8_STRING]; #endif - XChangeProperty (display->display, rq.requestor, rq.property, XA_ATOM, + XChangeProperty (disp, rq.requestor, rq.property, XA_ATOM, 32, PropModeReplace, (unsigned char *)target_list, target - target_list); ev.property = rq.property; @@ -3578,7 +3573,7 @@ #endif else if (rq.target == xa[XA_TIMESTAMP] && selection.text) { - XChangeProperty (display->display, rq.requestor, rq.property, rq.target, + XChangeProperty (disp, rq.requestor, rq.property, rq.target, 32, PropModeReplace, (unsigned char *)&selection_time, 1); ev.property = rq.property; } @@ -3646,7 +3641,7 @@ } else #endif - if (XwcTextListToTextProperty (display->display, &cl, 1, (XICCEncodingStyle) style, &ct) >= 0) + if (XwcTextListToTextProperty (disp, &cl, 1, (XICCEncodingStyle) style, &ct) >= 0) freect = 1; else { @@ -3656,7 +3651,7 @@ ct.encoding = target; } - XChangeProperty (display->display, rq.requestor, rq.property, + XChangeProperty (disp, rq.requestor, rq.property, ct.encoding, 8, PropModeReplace, ct.value, (int)ct.nitems); ev.property = rq.property; @@ -3665,7 +3660,7 @@ XFree (ct.value); } - XSendEvent (display->display, rq.requestor, False, 0L, (XEvent *)&ev); + XSendEvent (disp, rq.requestor, False, 0L, (XEvent *)&ev); } /* ------------------------------------------------------------------------- *