ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/screen.C
(Generate patch)

Comparing rxvt-unicode/src/screen.C (file contents):
Revision 1.198 by root, Tue Dec 27 01:25:42 2005 UTC vs.
Revision 1.209 by root, Thu Jan 5 01:04:10 2006 UTC

24 * This file handles _all_ screen updates and selections 24 * This file handles _all_ screen updates and selections
25 */ 25 */
26 26
27#include "../config.h" /* NECESSARY */ 27#include "../config.h" /* NECESSARY */
28#include "rxvt.h" /* NECESSARY */ 28#include "rxvt.h" /* NECESSARY */
29#include "rxvtperl.h" /* NECESSARY */
29 30
30#include <X11/Xmd.h> /* get the typedef for CARD32 */ 31#include <X11/Xmd.h> /* get the typedef for CARD32 */
31 32
32#include <inttypes.h> 33#include <inttypes.h>
33 34
46 47
47/* ------------------------------------------------------------------------- * 48/* ------------------------------------------------------------------------- *
48 * GENERAL SCREEN AND SELECTION UPDATE ROUTINES * 49 * GENERAL SCREEN AND SELECTION UPDATE ROUTINES *
49 * ------------------------------------------------------------------------- */ 50 * ------------------------------------------------------------------------- */
50#define ZERO_SCROLLBACK() \ 51#define ZERO_SCROLLBACK() \
51 if (options & Opt_scrollTtyOutput) \ 52 if (OPTION (Opt_scrollTtyOutput)) \
52 view_start = 0 53 view_start = 0
53#define CLEAR_SELECTION() \ 54#define CLEAR_SELECTION() \
54 selection.beg.row = selection.beg.col \ 55 selection.beg.row = selection.beg.col \
55 = selection.end.row = selection.end.col = 0 56 = selection.end.row = selection.end.col = 0
56#define CLEAR_ALL_SELECTION() \ 57#define CLEAR_ALL_SELECTION() \
417 418
418 for (int col = ncol; col--; ) 419 for (int col = ncol; col--; )
419 tabs [col] = col % TABSIZE == 0; 420 tabs [col] = col % TABSIZE == 0;
420 421
421 tt_winch (); 422 tt_winch ();
423
424 PERL_INVOKE ((this, HOOK_RESET, DT_END));
422} 425}
423 426
424/* ------------------------------------------------------------------------- */ 427/* ------------------------------------------------------------------------- */
425/* 428/*
426 * Free everything. That way malloc debugging can find leakage. 429 * Free everything. That way malloc debugging can find leakage.
530 533
531 screen.cur.row = clamp (screen.cur.row, 0, prev_nrow - 1); 534 screen.cur.row = clamp (screen.cur.row, 0, prev_nrow - 1);
532 screen.cur.col = clamp (screen.cur.col, 0, prev_ncol - 1); 535 screen.cur.col = clamp (screen.cur.col, 0, prev_ncol - 1);
533 536
534#if NSCREENS 537#if NSCREENS
535 if (options & Opt_secondaryScreen) 538 if (OPTION (Opt_secondaryScreen))
536 { 539 {
537 num_scr = 0; 540 num_scr = 0;
538 541
539 for (int i = prev_nrow; i--; ) 542 for (int i = prev_nrow; i--; )
540 ::swap (ROW(i), swap_buf [i]); 543 ::swap (ROW(i), swap_buf [i]);
544 screen.flags |= Screen_VisibleCursor; 547 screen.flags |= Screen_VisibleCursor;
545 swap.flags |= Screen_VisibleCursor; 548 swap.flags |= Screen_VisibleCursor;
546 } 549 }
547 else 550 else
548#endif 551#endif
549 if (options & Opt_secondaryScroll) 552 if (OPTION (Opt_secondaryScroll))
550 scr_scroll_text (0, prev_nrow - 1, prev_nrow); 553 scr_scroll_text (0, prev_nrow - 1, prev_nrow);
551 554
552 return scrn; 555 return scrn;
553} 556}
554 557
616 num_scr += count; 619 num_scr += count;
617 620
618 if (count > 0 621 if (count > 0
619 && row1 == 0 622 && row1 == 0
620 && row2 == nrow - 1 623 && row2 == nrow - 1
621 && (current_screen == PRIMARY || options & Opt_secondaryScroll)) 624 && (current_screen == PRIMARY || OPTION (Opt_secondaryScroll)))
622 { 625 {
623 nsaved = min (nsaved + count, saveLines); 626 nsaved = min (nsaved + count, saveLines);
627
628 PERL_INVOKE ((this, HOOK_SCROLL_BACK, DT_INT, count, DT_INT, nsaved, DT_END));
629
624 term_start = (term_start + count) % total_rows; 630 term_start = (term_start + count) % total_rows;
625 631
626 if (selection.op && current_screen == selection.screen) 632 if (selection.op && current_screen == selection.screen)
627 { 633 {
628 selection.beg.row -= count; 634 selection.beg.row -= count;
642 { 648 {
643 ROW(row2 - i).l = 0; 649 ROW(row2 - i).l = 0;
644 scr_blank_screen_mem (ROW(row2 - i), rstyle); 650 scr_blank_screen_mem (ROW(row2 - i), rstyle);
645 } 651 }
646 652
647 if ((options & Opt_scrollWithBuffer) 653 if (OPTION (Opt_scrollWithBuffer)
648 && view_start != 0 654 && view_start != 0
649 && view_start != saveLines) 655 && view_start != saveLines)
650 scr_page (UP, count); 656 scr_page (UP, count);
651 } 657 }
652 else 658 else
716 last_col = ncol; 722 last_col = ncol;
717 723
718 if (nlines > 0) 724 if (nlines > 0)
719 { 725 {
720 nlines += screen.cur.row - screen.bscroll; 726 nlines += screen.cur.row - screen.bscroll;
727
721 if (nlines > 0 728 if (nlines > 0
722 && screen.tscroll == 0 729 && screen.tscroll == 0
723 && screen.bscroll == (nrow - 1)) 730 && screen.bscroll == (nrow - 1))
724 { 731 {
725 /* _at least_ this many lines need to be scrolled */ 732 /* _at least_ this many lines need to be scrolled */
1018 if (count) 1025 if (count)
1019 x = ncol - 1; 1026 x = ncol - 1;
1020 1027
1021 // store horizontal tab commands as characters inside the text 1028 // store horizontal tab commands as characters inside the text
1022 // buffer so they can be selected and pasted. 1029 // buffer so they can be selected and pasted.
1023 if (ht && options & Opt_pastableTabs) 1030 if (ht && OPTION (Opt_pastableTabs))
1024 { 1031 {
1025 base_rend = SET_FONT (base_rend, 0); 1032 base_rend = SET_FONT (base_rend, 0);
1026 1033
1027 if (!l.is_longer ()) /* XXX: think about this */ 1034 if (!l.is_longer ()) /* XXX: think about this */
1028 max_it (l.l, x); 1035 max_it (l.l, x);
1284 CLEAR_ROWS (row, num); 1291 CLEAR_ROWS (row, num);
1285 } 1292 }
1286 else 1293 else
1287 { 1294 {
1288 ren = rstyle & (RS_fgMask | RS_bgMask); 1295 ren = rstyle & (RS_fgMask | RS_bgMask);
1289 gcvalue.foreground = pix_colors[GET_BGCOLOR (rstyle)]; 1296 gcvalue.foreground = pix_colors[bgcolor_of (rstyle)];
1290 XChangeGC (display->display, gc, GCForeground, &gcvalue); 1297 XChangeGC (display->display, gc, GCForeground, &gcvalue);
1291 ERASE_ROWS (row, num); 1298 ERASE_ROWS (row, num);
1292 gcvalue.foreground = pix_colors[Color_fg]; 1299 gcvalue.foreground = pix_colors[Color_fg];
1293 XChangeGC (display->display, gc, GCForeground, &gcvalue); 1300 XChangeGC (display->display, gc, GCForeground, &gcvalue);
1294 } 1301 }
1593 ::swap (pix_colors[Color_fg], pix_colors[Color_bg]); 1600 ::swap (pix_colors[Color_fg], pix_colors[Color_bg]);
1594#if XPM_BACKGROUND 1601#if XPM_BACKGROUND
1595 if (bgPixmap.pixmap == None) 1602 if (bgPixmap.pixmap == None)
1596#endif 1603#endif
1597#if TRANSPARENT 1604#if TRANSPARENT
1598 if (! (options & Opt_transparent) || am_transparent == 0) 1605 if (! OPTION (Opt_transparent) || am_transparent == 0)
1599#endif 1606#endif
1600 XSetWindowBackground (display->display, vt, 1607 XSetWindowBackground (display->display, vt,
1601 pix_colors[Color_bg]); 1608 pix_colors[Color_bg]);
1602 1609
1603 gcvalue.foreground = pix_colors[Color_fg]; 1610 gcvalue.foreground = pix_colors[Color_fg];
1819} 1826}
1820 1827
1821int 1828int
1822rxvt_term::scr_changeview (unsigned int oldviewstart) 1829rxvt_term::scr_changeview (unsigned int oldviewstart)
1823{ 1830{
1831 PERL_INVOKE ((this, HOOK_VIEW_CHANGE, DT_INT, view_start, DT_END));
1832
1824 if (view_start != oldviewstart) 1833 if (view_start != oldviewstart)
1825 { 1834 {
1826 want_refresh = 1; 1835 want_refresh = 1;
1827 num_scr -= (view_start - oldviewstart); 1836 num_scr -= (view_start - oldviewstart);
1828 } 1837 }
1836{ 1845{
1837#ifndef NO_BELL 1846#ifndef NO_BELL
1838 1847
1839# ifndef NO_MAPALERT 1848# ifndef NO_MAPALERT
1840# ifdef MAPALERT_OPTION 1849# ifdef MAPALERT_OPTION
1841 if (options & Opt_mapAlert) 1850 if (OPTION (Opt_mapAlert))
1842# endif 1851# endif
1843 XMapWindow (display->display, parent[0]); 1852 XMapWindow (display->display, parent[0]);
1844# endif 1853# endif
1845 1854
1846 if (options & Opt_visualBell) 1855 if (OPTION (Opt_visualBell))
1847 { 1856 {
1848 scr_rvideo_mode (!rvideo); /* refresh also done */ 1857 scr_rvideo_mode (!rvideo); /* refresh also done */
1849 rxvt_usleep (VISUAL_BELL_DURATION); 1858 rxvt_usleep (VISUAL_BELL_DURATION);
1850 scr_rvideo_mode (!rvideo); /* refresh also done */ 1859 scr_rvideo_mode (!rvideo); /* refresh also done */
1851 } 1860 }
1942 1951
1943#if XPM_BACKGROUND 1952#if XPM_BACKGROUND
1944 must_clear |= bgPixmap.pixmap != None; 1953 must_clear |= bgPixmap.pixmap != None;
1945#endif 1954#endif
1946#if TRANSPARENT 1955#if TRANSPARENT
1947 must_clear |= (options & Opt_transparent) && am_transparent; 1956 must_clear |= OPTION (Opt_transparent) && am_transparent;
1948#endif 1957#endif
1949 ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ 1958 ocrow = oldcursor.row; /* is there an old outline cursor on screen? */
1950 1959
1951 /* 1960 /*
1952 * B: reverse any characters which are selected 1961 * B: reverse any characters which are selected
1976 1985
1977 crp = &ROW(screen.cur.row).r[col]; 1986 crp = &ROW(screen.cur.row).r[col];
1978 1987
1979 if (showcursor && focus) 1988 if (showcursor && focus)
1980 { 1989 {
1981 if (options & Opt_cursorUnderline) 1990 if (OPTION (Opt_cursorUnderline))
1982 *crp ^= RS_Uline; 1991 *crp ^= RS_Uline;
1983 else 1992 else
1984 { 1993 {
1985 *crp ^= RS_RVid; 1994 *crp ^= RS_RVid;
1986 1995
1988 cc1 = *crp & (RS_fgMask | RS_bgMask); 1997 cc1 = *crp & (RS_fgMask | RS_bgMask);
1989 if (ISSET_PIXCOLOR (Color_cursor)) 1998 if (ISSET_PIXCOLOR (Color_cursor))
1990 ccol1 = Color_cursor; 1999 ccol1 = Color_cursor;
1991 else 2000 else
1992#ifdef CURSOR_COLOR_IS_RENDITION_COLOR 2001#ifdef CURSOR_COLOR_IS_RENDITION_COLOR
1993 ccol1 = GET_FGCOLOR (rstyle); 2002 ccol1 = fgcolor_of (rstyle);
1994#else 2003#else
1995 ccol1 = Color_fg; 2004 ccol1 = Color_fg;
1996#endif 2005#endif
1997 if (ISSET_PIXCOLOR (Color_cursor2)) 2006 if (ISSET_PIXCOLOR (Color_cursor2))
1998 ccol2 = Color_cursor2; 2007 ccol2 = Color_cursor2;
1999 else 2008 else
2000#ifdef CURSOR_COLOR_IS_RENDITION_COLOR 2009#ifdef CURSOR_COLOR_IS_RENDITION_COLOR
2001 ccol2 = GET_BGCOLOR (rstyle); 2010 ccol2 = bgcolor_of (rstyle);
2002#else 2011#else
2003 ccol2 = Color_bg; 2012 ccol2 = Color_bg;
2004#endif 2013#endif
2005 *crp = SET_FGCOLOR (*crp, ccol1); 2014 *crp = SET_FGCOLOR (*crp, ccol1);
2006 *crp = SET_BGCOLOR (*crp, ccol2); 2015 *crp = SET_BGCOLOR (*crp, ccol2);
2039 oldcursor.col = screen.cur.col; 2048 oldcursor.col = screen.cur.col;
2040 } 2049 }
2041 } 2050 }
2042 } 2051 }
2043 2052
2053 PERL_INVOKE ((this, HOOK_REFRESH_BEGIN, DT_END));
2044#if ENABLE_OVERLAY 2054#if ENABLE_OVERLAY
2045 scr_swap_overlay (); 2055 scr_swap_overlay ();
2046#endif 2056#endif
2047 2057
2048#ifndef NO_SLOW_LINK_SUPPORT 2058#ifndef NO_SLOW_LINK_SUPPORT
2098 if (wlen < len) 2108 if (wlen < len)
2099 ::swap (wlen, len); 2109 ::swap (wlen, len);
2100 2110
2101 XCopyArea (display->display, vt, vt, 2111 XCopyArea (display->display, vt, vt,
2102 gc, 0, Row2Pixel (len + i), 2112 gc, 0, Row2Pixel (len + i),
2103 (unsigned int)TermWin_TotalWidth (), 2113 (unsigned int)this->width,
2104 (unsigned int)Height2Pixel (wlen - len + 1), 2114 (unsigned int)Height2Pixel (wlen - len + 1),
2105 0, Row2Pixel (len)); 2115 0, Row2Pixel (len));
2106 len = -1; 2116 len = -1;
2107 } 2117 }
2108 } 2118 }
2187 count++, i--; 2197 count++, i--;
2188 2198
2189 /* 2199 /*
2190 * Determine the attributes for the string 2200 * Determine the attributes for the string
2191 */ 2201 */
2192 int fore = GET_FGCOLOR (rend); // desired foreground 2202 int fore = fgcolor_of (rend); // desired foreground
2193 int back = GET_BGCOLOR (rend); // desired background 2203 int back = bgcolor_of (rend); // desired background
2194 2204
2195 // only do special processing if any attributes are set, which is unlikely 2205 // only do special processing if any attributes are set, which is unlikely
2196 if (rend & (RS_Bold | RS_Italic | RS_Uline | RS_RVid | RS_Blink | RS_Careful)) 2206 if (rend & (RS_Bold | RS_Italic | RS_Uline | RS_RVid | RS_Blink | RS_Careful))
2197 { 2207 {
2198#if ENABLE_STYLES 2208#if ENABLE_STYLES
2311 } /* for (row....) */ 2321 } /* for (row....) */
2312 2322
2313#if ENABLE_OVERLAY 2323#if ENABLE_OVERLAY
2314 scr_swap_overlay (); 2324 scr_swap_overlay ();
2315#endif 2325#endif
2326 PERL_INVOKE ((this, HOOK_REFRESH_END, DT_END));
2316 2327
2317 /* 2328 /*
2318 * G: cleanup cursor and display outline cursor if necessary 2329 * G: cleanup cursor and display outline cursor if necessary
2319 */ 2330 */
2320 if (showcursor) 2331 if (showcursor)
2321 { 2332 {
2322 if (focus) 2333 if (focus)
2323 { 2334 {
2324 if (options & Opt_cursorUnderline) 2335 if (OPTION (Opt_cursorUnderline))
2325 *crp ^= RS_Uline; 2336 *crp ^= RS_Uline;
2326 else 2337 else
2327 { 2338 {
2328 *crp ^= RS_RVid; 2339 *crp ^= RS_RVid;
2329#ifndef NO_CURSORCOLOR 2340#ifndef NO_CURSORCOLOR
2448 2459
2449#if ENABLE_FRILLS 2460#if ENABLE_FRILLS
2450 if (selection.rect) 2461 if (selection.rect)
2451 { 2462 {
2452 for (row = max (selection.beg.row, -view_start); row <= min (selection.end.row, view_end); row++) 2463 for (row = max (selection.beg.row, -view_start); row <= min (selection.end.row, view_end); row++)
2464 {
2465 text_t *stp = ROW(row).t;
2466 rend_t *srp = ROW(row).r;
2467
2453 for (rend_t *srp = ROW(row).r, col = selection.beg.col; col < selection.end.col; col++) 2468 for (col = selection.beg.col; col < selection.end.col; col++)
2454 srp[col] ^= RS_RVid; 2469 srp[col] ^= RS_RVid;
2470
2471 while (col-- > selection.beg.col && (stp[col] == NOCHAR || unicode::is_space (stp[col])))
2472 srp[col] ^= RS_RVid | RS_Uline;
2473
2474 if (++col < selection.end.col)
2475 srp[col] ^= RS_RVid | RS_Uline;
2476 }
2455 } 2477 }
2456 else 2478 else
2457#endif 2479#endif
2458 { 2480 {
2459 if (selection.beg.row >= -view_start) 2481 if (selection.beg.row >= -view_start)
2543/* ------------------------------------------------------------------------- */ 2565/* ------------------------------------------------------------------------- */
2544/* 2566/*
2545 * Paste a selection direct to the command fd 2567 * Paste a selection direct to the command fd
2546 */ 2568 */
2547void 2569void
2548rxvt_term::paste (unsigned char *data, unsigned int len) 2570rxvt_term::paste (char *data, unsigned int len)
2549{ 2571{
2550 /* convert normal newline chars into common keyboard Return key sequence */ 2572 /* convert normal newline chars into common keyboard Return key sequence */
2551 for (unsigned int i = 0; i < len; i++) 2573 for (unsigned int i = 0; i < len; i++)
2552 if (data[i] == C0_LF) 2574 if (data[i] == C0_LF)
2553 data[i] = C0_CR; 2575 data[i] = C0_CR;
2697 { 2719 {
2698 wchar_t *w = rxvt_utf8towcs ((const char *)ct.value, ct.nitems); 2720 wchar_t *w = rxvt_utf8towcs ((const char *)ct.value, ct.nitems);
2699 char *s = rxvt_wcstombs (w); 2721 char *s = rxvt_wcstombs (w);
2700 free (w); 2722 free (w);
2701 // TODO: strlen == only the first element will be converted. well... 2723 // TODO: strlen == only the first element will be converted. well...
2702 paste ((unsigned char *)s, strlen (s)); 2724 paste (s, strlen (s));
2703 free (s); 2725 free (s);
2704 } 2726 }
2705 else 2727 else
2706#endif 2728#endif
2707 if (XmbTextPropertyToTextList (display->display, &ct, &cl, &cr) >= 0 2729 if (XmbTextPropertyToTextList (display->display, &ct, &cl, &cr) >= 0
2708 && cl) 2730 && cl)
2709 { 2731 {
2710 for (int i = 0; i < cr; i++) 2732 for (int i = 0; i < cr; i++)
2711 paste ((unsigned char *)cl[i], strlen (cl[i])); 2733 paste (cl[i], strlen (cl[i]));
2712 2734
2713 XFreeStringList (cl); 2735 XFreeStringList (cl);
2714 } 2736 }
2715 else 2737 else
2716 paste (ct.value, ct.nitems); // paste raw 2738 paste ((char *)ct.value, ct.nitems); // paste raw
2717 2739
2718bailout: 2740bailout:
2719 XFree (ct.value); 2741 XFree (ct.value);
2720 2742
2721 if (selection_wait == Sel_normal) 2743 if (selection_wait == Sel_normal)
2759 return; /* outside window */ 2781 return; /* outside window */
2760 2782
2761 if (selection.text) 2783 if (selection.text)
2762 { /* internal selection */ 2784 { /* internal selection */
2763 char *str = rxvt_wcstombs (selection.text, selection.len); 2785 char *str = rxvt_wcstombs (selection.text, selection.len);
2764 paste ((unsigned char *)str, strlen (str)); 2786 paste (str, strlen (str));
2765 free (str); 2787 free (str);
2766 return; 2788 return;
2767 } 2789 }
2768 else 2790 else
2769 { 2791 {
2861 selection.op = SELECTION_DONE; 2883 selection.op = SELECTION_DONE;
2862 2884
2863 if (selection.clicks == 4) 2885 if (selection.clicks == 4)
2864 return; /* nothing selected, go away */ 2886 return; /* nothing selected, go away */
2865 2887
2888 if (PERL_INVOKE ((this, HOOK_SEL_MAKE, DT_LONG, (long)tm, DT_END)))
2889 return;
2890
2866 i = (selection.end.row - selection.beg.row + 1) * (ncol + 1); 2891 i = (selection.end.row - selection.beg.row + 1) * (ncol + 1);
2867 new_selection_text = (wchar_t *)rxvt_malloc ((i + 4) * sizeof (wchar_t)); 2892 new_selection_text = (wchar_t *)rxvt_malloc ((i + 4) * sizeof (wchar_t));
2868 2893
2869 int ofs = 0; 2894 int ofs = 0;
2870 int extra = 0; 2895 int extra = 0;
2886#endif 2911#endif
2887 end_col = ROW(row).is_longer () ? ncol : ROW(row).l; //TODO//FIXME//LEN 2912 end_col = ROW(row).is_longer () ? ncol : ROW(row).l; //TODO//FIXME//LEN
2888 2913
2889 col = max (col, 0); 2914 col = max (col, 0);
2890 2915
2891 if (row == selection.end.row || selection.rect) 2916 if (row == selection.end.row
2917#if ENABLE_FRILLS
2918 || selection.rect
2919#endif
2920 )
2892 end_col = min (end_col, selection.end.col); 2921 min_it (end_col, selection.end.col);
2893 2922
2894 t = ROW(row).t + col; 2923 t = ROW(row).t + col;
2895 for (; col < end_col; col++) 2924 for (; col < end_col; col++)
2896 { 2925 {
2897 if (*t == NOCHAR) 2926 if (*t == NOCHAR)
2915#endif 2944#endif
2916 else 2945 else
2917 new_selection_text[ofs++] = *t++; 2946 new_selection_text[ofs++] = *t++;
2918 } 2947 }
2919 2948
2949#if ENABLE_FRILLS
2950 if (selection.rect)
2951 {
2952 while (ofs
2953 && new_selection_text[ofs - 1] != C0_LF
2954 && unicode::is_space (new_selection_text[ofs - 1]))
2955 --ofs;
2956
2957 new_selection_text[ofs++] = C0_LF;
2958 }
2959 else
2960#endif
2920 if (!ROW(row).is_longer () && row != selection.end.row) 2961 if (!ROW(row).is_longer () && row != selection.end.row)
2921 new_selection_text[ofs++] = C0_LF; 2962 new_selection_text[ofs++] = C0_LF;
2922 } 2963 }
2923 2964
2924 if (end_col != selection.end.col) 2965 if (end_col != selection.end.col)
2925 new_selection_text[ofs++] = C0_LF; 2966 new_selection_text[ofs++] = C0_LF;
2926 2967
2936 2977
2937 // we usually allocate much more than necessary, so realloc it smaller again 2978 // we usually allocate much more than necessary, so realloc it smaller again
2938 selection.len = ofs; 2979 selection.len = ofs;
2939 selection.text = (wchar_t *)rxvt_realloc (new_selection_text, (ofs + 1) * sizeof (wchar_t)); 2980 selection.text = (wchar_t *)rxvt_realloc (new_selection_text, (ofs + 1) * sizeof (wchar_t));
2940 2981
2982 if (PERL_INVOKE ((this, HOOK_SEL_GRAB, DT_LONG, (long)tm, DT_END)))
2983 return;
2984
2985 selection_grab (tm);
2986}
2987
2988bool
2989rxvt_term::selection_grab (Time tm)
2990{
2991 selection_time = tm;
2992
2941 XSetSelectionOwner (display->display, XA_PRIMARY, vt, tm); 2993 XSetSelectionOwner (display->display, XA_PRIMARY, vt, tm);
2942 if (XGetSelectionOwner (display->display, XA_PRIMARY) == vt) 2994 if (XGetSelectionOwner (display->display, XA_PRIMARY) == vt)
2995 {
2943 display->set_selection_owner (this); 2996 display->set_selection_owner (this);
2997 return true;
2998 }
2944 else 2999 else
2945 rxvt_warn ("can't get primary selection, ignoring.\n"); 3000 return false;
2946 3001
2947#if 0 3002#if 0
2948 XTextProperty ct; 3003 XTextProperty ct;
2949 3004
2950 if (XwcTextListToTextProperty (display->display, &selection.text, 1, XStringStyle, &ct) >= 0) 3005 if (XwcTextListToTextProperty (display->display, &selection.text, 1, XStringStyle, &ct) >= 0)
2951 { 3006 {
2952 set_string_property (XA_CUT_BUFFER0, ct.value, ct.nitems); 3007 set_string_property (XA_CUT_BUFFER0, ct.value, ct.nitems);
2953 XFree (ct.value); 3008 XFree (ct.value);
2954 } 3009 }
2955#endif 3010#endif
2956
2957 selection_time = tm;
2958} 3011}
2959 3012
2960/* ------------------------------------------------------------------------- */ 3013/* ------------------------------------------------------------------------- */
2961/* 3014/*
2962 * Mark or select text based upon number of clicks: 1, 2, or 3 3015 * Mark or select text based upon number of clicks: 1, 2, or 3
3084 } 3137 }
3085 } 3138 }
3086 break; 3139 break;
3087 } 3140 }
3088 3141
3089Old_Word_Selection_You_Die:
3090 if (dirn == DN) 3142 if (dirn == DN)
3091 col++; /* put us on one past the end */ 3143 col++; /* put us on one past the end */
3092 3144
3093 /* Poke the values back in */ 3145 /* Poke the values back in */
3094 ret->row = row; 3146 ret->row = row;
3271 else if (selection.clicks == 2) 3323 else if (selection.clicks == 2)
3272 { 3324 {
3273 if (ROWCOL_IS_AFTER (selection.end, selection.beg)) 3325 if (ROWCOL_IS_AFTER (selection.end, selection.beg))
3274 selection.end.col--; 3326 selection.end.col--;
3275 3327
3328 if (!PERL_INVOKE ((this, HOOK_SEL_EXTEND, DT_END)))
3329 {
3276 selection_delimit_word (UP, &selection.beg, &selection.beg); 3330 selection_delimit_word (UP, &selection.beg, &selection.beg);
3277 selection_delimit_word (DN, &selection.end, &selection.end); 3331 selection_delimit_word (DN, &selection.end, &selection.end);
3332 }
3278 } 3333 }
3279 else if (selection.clicks == 3) 3334 else if (selection.clicks == 3)
3280 { 3335 {
3281#if ENABLE_FRILLS 3336#if ENABLE_FRILLS
3282 if (options & Opt_tripleclickwords) 3337 if (OPTION (Opt_tripleclickwords))
3283 { 3338 {
3284 selection_delimit_word (UP, &selection.beg, &selection.beg); 3339 selection_delimit_word (UP, &selection.beg, &selection.beg);
3285 3340
3286 for (int end_row = selection.mark.row; end_row < nrow; end_row++) 3341 for (int end_row = selection.mark.row; end_row < nrow; end_row++)
3287 { 3342 {
3348 { 3403 {
3349 stp = ROW(end_row).t; 3404 stp = ROW(end_row).t;
3350 3405
3351 while (--end_col >= 0) 3406 while (--end_col >= 0)
3352 { 3407 {
3353 if (stp[end_col] != ' ' 3408 if (stp[end_col] != NOCHAR
3354 && stp[end_col] != '\t' 3409 && !unicode::is_space (stp[end_col]))
3355 && stp[end_col] != NOCHAR)
3356 break; 3410 break;
3357 } 3411 }
3358 3412
3359 if (end_col >= 0 3413 if (end_col >= 0
3360 || !ROW(end_row - 1).is_longer ()) 3414 || !ROW(end_row - 1).is_longer ())
3559 3613
3560#if ENABLE_OVERLAY 3614#if ENABLE_OVERLAY
3561void 3615void
3562rxvt_term::scr_overlay_new (int x, int y, int w, int h) 3616rxvt_term::scr_overlay_new (int x, int y, int w, int h)
3563{ 3617{
3564 if (nrow < 3 || ncol < 3) 3618 if (nrow < 1 || ncol < 1)
3565 return; 3619 return;
3566 3620
3567 want_refresh = 1; 3621 want_refresh = 1;
3568 3622
3569 scr_overlay_off (); 3623 scr_overlay_off ();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines