--- rxvt-unicode/src/screen.C 2010/07/01 21:52:52 1.343 +++ rxvt-unicode/src/screen.C 2010/10/15 11:07:45 1.351 @@ -30,7 +30,7 @@ #include -#include "salloc.C" // HACK, should be a seperate compile! +#include "salloc.C" // HACK, should be a separate compile! static inline void fill_text (text_t *start, text_t value, int len) @@ -900,6 +900,22 @@ # endif #endif + rend_t rend = SET_FONT (rstyle, FONTSET (rstyle)->find_font (c)); + + // if the character doesn't fit into the remaining columns... + if (expect_false (screen.cur.col > ncol - width && ncol >= width)) + { + if (screen.flags & Screen_Autowrap) + { + // ... artificially enlargen the previous one + c = NOCHAR; + // and try the same character next loop iteration + --str; + } + else + screen.cur.col = ncol - width; + } + // nuke the character at this position, if required if (expect_false ( line->t[screen.cur.col] == NOCHAR @@ -908,17 +924,6 @@ )) scr_kill_char (*line, screen.cur.col); - rend_t rend = SET_FONT (rstyle, FONTSET (rstyle)->find_font (c)); - - // if the character doesn't fit into the remaining columns... - if (expect_false (screen.cur.col > ncol - width && ncol >= width)) - { - // ... artificially enlargen the previous one - c = NOCHAR; - // and try the same character next loop iteration - --str; - } - line->touch (); do @@ -1023,6 +1028,8 @@ #endif } } + else if (screen.flags & Screen_WrapNext) + screen.flags &= ~Screen_WrapNext; else scr_gotorc (0, -1, RELATIVE); } @@ -1338,16 +1345,13 @@ min_it (num, nrow - row); - // TODO: the code below does not work when view_start != 0 - // the workaround is to disable the clear and use a normal refresh - // when view_start != 0. mysterious. if (rstyle & (RS_Blink | RS_RVid | RS_Uline)) ren = (rend_t) ~RS_None; else if (GET_BASEBG (rstyle) == Color_bg) { ren = DEFAULT_RSTYLE; - if (mapped && !view_start) + if (mapped) XClearArea (dpy, vt, 0, Row2Pixel (row - view_start), (unsigned int)width, (unsigned int)Height2Pixel (num), False); @@ -1356,7 +1360,7 @@ { ren = rstyle & (RS_fgMask | RS_bgMask); - if (mapped && !view_start) + if (mapped) { gcvalue.foreground = pix_colors[bgcolor_of (rstyle)]; XChangeGC (dpy, gc, GCForeground, &gcvalue); @@ -1373,8 +1377,8 @@ { scr_blank_screen_mem (ROW(row), rstyle); - if (!view_start) - scr_blank_line (drawn_buf [row], 0, ncol, ren); + if (row - view_start < nrow) + scr_blank_line (drawn_buf [row - view_start], 0, ncol, ren); } } @@ -2681,7 +2685,7 @@ * Paste a selection direct to the command fd */ void -rxvt_term::paste (char *data, unsigned int len) NOTHROW +rxvt_term::tt_paste (char *data, unsigned int len) NOTHROW { /* convert normal newline chars into common keyboard Return key sequence */ for (unsigned int i = 0; i < len; i++) @@ -2697,6 +2701,15 @@ tt_printf ("\e[201~"); } +void +rxvt_term::paste (char *data, unsigned int len) NOTHROW +{ + if (HOOK_INVOKE ((this, HOOK_TT_PASTE, DT_STR_LEN, data, len, DT_END))) + return; + + tt_paste (data, len); +} + /* ------------------------------------------------------------------------- */ /* * Respond to a notification that a primary selection has been sent @@ -2979,20 +2992,6 @@ } } -void -rxvt_term::clipboard_copy (Time tm) -{ - if (selection.len > 0) - { - free (selection.clip_text); - selection.clip_len = selection.len; - selection.clip_text = (wchar_t *) malloc (sizeof (wchar_t) * selection.clip_len); - memcpy (selection.clip_text, selection.text, - sizeof (wchar_t) * selection.clip_len); - selection_grab (tm, true); - } -} - /* ------------------------------------------------------------------------- */ /* * Copy a selection into the cut buffer