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.202 by root, Sat Dec 31 17:16:17 2005 UTC

46 46
47/* ------------------------------------------------------------------------- * 47/* ------------------------------------------------------------------------- *
48 * GENERAL SCREEN AND SELECTION UPDATE ROUTINES * 48 * GENERAL SCREEN AND SELECTION UPDATE ROUTINES *
49 * ------------------------------------------------------------------------- */ 49 * ------------------------------------------------------------------------- */
50#define ZERO_SCROLLBACK() \ 50#define ZERO_SCROLLBACK() \
51 if (options & Opt_scrollTtyOutput) \ 51 if (OPTION (Opt_scrollTtyOutput)) \
52 view_start = 0 52 view_start = 0
53#define CLEAR_SELECTION() \ 53#define CLEAR_SELECTION() \
54 selection.beg.row = selection.beg.col \ 54 selection.beg.row = selection.beg.col \
55 = selection.end.row = selection.end.col = 0 55 = selection.end.row = selection.end.col = 0
56#define CLEAR_ALL_SELECTION() \ 56#define CLEAR_ALL_SELECTION() \
530 530
531 screen.cur.row = clamp (screen.cur.row, 0, prev_nrow - 1); 531 screen.cur.row = clamp (screen.cur.row, 0, prev_nrow - 1);
532 screen.cur.col = clamp (screen.cur.col, 0, prev_ncol - 1); 532 screen.cur.col = clamp (screen.cur.col, 0, prev_ncol - 1);
533 533
534#if NSCREENS 534#if NSCREENS
535 if (options & Opt_secondaryScreen) 535 if (OPTION (Opt_secondaryScreen))
536 { 536 {
537 num_scr = 0; 537 num_scr = 0;
538 538
539 for (int i = prev_nrow; i--; ) 539 for (int i = prev_nrow; i--; )
540 ::swap (ROW(i), swap_buf [i]); 540 ::swap (ROW(i), swap_buf [i]);
544 screen.flags |= Screen_VisibleCursor; 544 screen.flags |= Screen_VisibleCursor;
545 swap.flags |= Screen_VisibleCursor; 545 swap.flags |= Screen_VisibleCursor;
546 } 546 }
547 else 547 else
548#endif 548#endif
549 if (options & Opt_secondaryScroll) 549 if (OPTION (Opt_secondaryScroll))
550 scr_scroll_text (0, prev_nrow - 1, prev_nrow); 550 scr_scroll_text (0, prev_nrow - 1, prev_nrow);
551 551
552 return scrn; 552 return scrn;
553} 553}
554 554
616 num_scr += count; 616 num_scr += count;
617 617
618 if (count > 0 618 if (count > 0
619 && row1 == 0 619 && row1 == 0
620 && row2 == nrow - 1 620 && row2 == nrow - 1
621 && (current_screen == PRIMARY || options & Opt_secondaryScroll)) 621 && (current_screen == PRIMARY || OPTION (Opt_secondaryScroll)))
622 { 622 {
623 nsaved = min (nsaved + count, saveLines); 623 nsaved = min (nsaved + count, saveLines);
624 term_start = (term_start + count) % total_rows; 624 term_start = (term_start + count) % total_rows;
625 625
626 if (selection.op && current_screen == selection.screen) 626 if (selection.op && current_screen == selection.screen)
642 { 642 {
643 ROW(row2 - i).l = 0; 643 ROW(row2 - i).l = 0;
644 scr_blank_screen_mem (ROW(row2 - i), rstyle); 644 scr_blank_screen_mem (ROW(row2 - i), rstyle);
645 } 645 }
646 646
647 if ((options & Opt_scrollWithBuffer) 647 if (OPTION (Opt_scrollWithBuffer)
648 && view_start != 0 648 && view_start != 0
649 && view_start != saveLines) 649 && view_start != saveLines)
650 scr_page (UP, count); 650 scr_page (UP, count);
651 } 651 }
652 else 652 else
1018 if (count) 1018 if (count)
1019 x = ncol - 1; 1019 x = ncol - 1;
1020 1020
1021 // store horizontal tab commands as characters inside the text 1021 // store horizontal tab commands as characters inside the text
1022 // buffer so they can be selected and pasted. 1022 // buffer so they can be selected and pasted.
1023 if (ht && options & Opt_pastableTabs) 1023 if (ht && OPTION (Opt_pastableTabs))
1024 { 1024 {
1025 base_rend = SET_FONT (base_rend, 0); 1025 base_rend = SET_FONT (base_rend, 0);
1026 1026
1027 if (!l.is_longer ()) /* XXX: think about this */ 1027 if (!l.is_longer ()) /* XXX: think about this */
1028 max_it (l.l, x); 1028 max_it (l.l, x);
1284 CLEAR_ROWS (row, num); 1284 CLEAR_ROWS (row, num);
1285 } 1285 }
1286 else 1286 else
1287 { 1287 {
1288 ren = rstyle & (RS_fgMask | RS_bgMask); 1288 ren = rstyle & (RS_fgMask | RS_bgMask);
1289 gcvalue.foreground = pix_colors[GET_BGCOLOR (rstyle)]; 1289 gcvalue.foreground = pix_colors[bgcolor_of (rstyle)];
1290 XChangeGC (display->display, gc, GCForeground, &gcvalue); 1290 XChangeGC (display->display, gc, GCForeground, &gcvalue);
1291 ERASE_ROWS (row, num); 1291 ERASE_ROWS (row, num);
1292 gcvalue.foreground = pix_colors[Color_fg]; 1292 gcvalue.foreground = pix_colors[Color_fg];
1293 XChangeGC (display->display, gc, GCForeground, &gcvalue); 1293 XChangeGC (display->display, gc, GCForeground, &gcvalue);
1294 } 1294 }
1593 ::swap (pix_colors[Color_fg], pix_colors[Color_bg]); 1593 ::swap (pix_colors[Color_fg], pix_colors[Color_bg]);
1594#if XPM_BACKGROUND 1594#if XPM_BACKGROUND
1595 if (bgPixmap.pixmap == None) 1595 if (bgPixmap.pixmap == None)
1596#endif 1596#endif
1597#if TRANSPARENT 1597#if TRANSPARENT
1598 if (! (options & Opt_transparent) || am_transparent == 0) 1598 if (! OPTION (Opt_transparent) || am_transparent == 0)
1599#endif 1599#endif
1600 XSetWindowBackground (display->display, vt, 1600 XSetWindowBackground (display->display, vt,
1601 pix_colors[Color_bg]); 1601 pix_colors[Color_bg]);
1602 1602
1603 gcvalue.foreground = pix_colors[Color_fg]; 1603 gcvalue.foreground = pix_colors[Color_fg];
1836{ 1836{
1837#ifndef NO_BELL 1837#ifndef NO_BELL
1838 1838
1839# ifndef NO_MAPALERT 1839# ifndef NO_MAPALERT
1840# ifdef MAPALERT_OPTION 1840# ifdef MAPALERT_OPTION
1841 if (options & Opt_mapAlert) 1841 if (OPTION (Opt_mapAlert))
1842# endif 1842# endif
1843 XMapWindow (display->display, parent[0]); 1843 XMapWindow (display->display, parent[0]);
1844# endif 1844# endif
1845 1845
1846 if (options & Opt_visualBell) 1846 if (OPTION (Opt_visualBell))
1847 { 1847 {
1848 scr_rvideo_mode (!rvideo); /* refresh also done */ 1848 scr_rvideo_mode (!rvideo); /* refresh also done */
1849 rxvt_usleep (VISUAL_BELL_DURATION); 1849 rxvt_usleep (VISUAL_BELL_DURATION);
1850 scr_rvideo_mode (!rvideo); /* refresh also done */ 1850 scr_rvideo_mode (!rvideo); /* refresh also done */
1851 } 1851 }
1942 1942
1943#if XPM_BACKGROUND 1943#if XPM_BACKGROUND
1944 must_clear |= bgPixmap.pixmap != None; 1944 must_clear |= bgPixmap.pixmap != None;
1945#endif 1945#endif
1946#if TRANSPARENT 1946#if TRANSPARENT
1947 must_clear |= (options & Opt_transparent) && am_transparent; 1947 must_clear |= OPTION (Opt_transparent) && am_transparent;
1948#endif 1948#endif
1949 ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ 1949 ocrow = oldcursor.row; /* is there an old outline cursor on screen? */
1950 1950
1951 /* 1951 /*
1952 * B: reverse any characters which are selected 1952 * B: reverse any characters which are selected
1976 1976
1977 crp = &ROW(screen.cur.row).r[col]; 1977 crp = &ROW(screen.cur.row).r[col];
1978 1978
1979 if (showcursor && focus) 1979 if (showcursor && focus)
1980 { 1980 {
1981 if (options & Opt_cursorUnderline) 1981 if (OPTION (Opt_cursorUnderline))
1982 *crp ^= RS_Uline; 1982 *crp ^= RS_Uline;
1983 else 1983 else
1984 { 1984 {
1985 *crp ^= RS_RVid; 1985 *crp ^= RS_RVid;
1986 1986
1988 cc1 = *crp & (RS_fgMask | RS_bgMask); 1988 cc1 = *crp & (RS_fgMask | RS_bgMask);
1989 if (ISSET_PIXCOLOR (Color_cursor)) 1989 if (ISSET_PIXCOLOR (Color_cursor))
1990 ccol1 = Color_cursor; 1990 ccol1 = Color_cursor;
1991 else 1991 else
1992#ifdef CURSOR_COLOR_IS_RENDITION_COLOR 1992#ifdef CURSOR_COLOR_IS_RENDITION_COLOR
1993 ccol1 = GET_FGCOLOR (rstyle); 1993 ccol1 = fgcolor_of (rstyle);
1994#else 1994#else
1995 ccol1 = Color_fg; 1995 ccol1 = Color_fg;
1996#endif 1996#endif
1997 if (ISSET_PIXCOLOR (Color_cursor2)) 1997 if (ISSET_PIXCOLOR (Color_cursor2))
1998 ccol2 = Color_cursor2; 1998 ccol2 = Color_cursor2;
1999 else 1999 else
2000#ifdef CURSOR_COLOR_IS_RENDITION_COLOR 2000#ifdef CURSOR_COLOR_IS_RENDITION_COLOR
2001 ccol2 = GET_BGCOLOR (rstyle); 2001 ccol2 = bgcolor_of (rstyle);
2002#else 2002#else
2003 ccol2 = Color_bg; 2003 ccol2 = Color_bg;
2004#endif 2004#endif
2005 *crp = SET_FGCOLOR (*crp, ccol1); 2005 *crp = SET_FGCOLOR (*crp, ccol1);
2006 *crp = SET_BGCOLOR (*crp, ccol2); 2006 *crp = SET_BGCOLOR (*crp, ccol2);
2187 count++, i--; 2187 count++, i--;
2188 2188
2189 /* 2189 /*
2190 * Determine the attributes for the string 2190 * Determine the attributes for the string
2191 */ 2191 */
2192 int fore = GET_FGCOLOR (rend); // desired foreground 2192 int fore = fgcolor_of (rend); // desired foreground
2193 int back = GET_BGCOLOR (rend); // desired background 2193 int back = bgcolor_of (rend); // desired background
2194 2194
2195 // only do special processing if any attributes are set, which is unlikely 2195 // 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)) 2196 if (rend & (RS_Bold | RS_Italic | RS_Uline | RS_RVid | RS_Blink | RS_Careful))
2197 { 2197 {
2198#if ENABLE_STYLES 2198#if ENABLE_STYLES
2319 */ 2319 */
2320 if (showcursor) 2320 if (showcursor)
2321 { 2321 {
2322 if (focus) 2322 if (focus)
2323 { 2323 {
2324 if (options & Opt_cursorUnderline) 2324 if (OPTION (Opt_cursorUnderline))
2325 *crp ^= RS_Uline; 2325 *crp ^= RS_Uline;
2326 else 2326 else
2327 { 2327 {
2328 *crp ^= RS_RVid; 2328 *crp ^= RS_RVid;
2329#ifndef NO_CURSORCOLOR 2329#ifndef NO_CURSORCOLOR
2448 2448
2449#if ENABLE_FRILLS 2449#if ENABLE_FRILLS
2450 if (selection.rect) 2450 if (selection.rect)
2451 { 2451 {
2452 for (row = max (selection.beg.row, -view_start); row <= min (selection.end.row, view_end); row++) 2452 for (row = max (selection.beg.row, -view_start); row <= min (selection.end.row, view_end); row++)
2453 {
2454 text_t *stp = ROW(row).t;
2455 rend_t *srp = ROW(row).r;
2456
2453 for (rend_t *srp = ROW(row).r, col = selection.beg.col; col < selection.end.col; col++) 2457 for (col = selection.beg.col; col < selection.end.col; col++)
2454 srp[col] ^= RS_RVid; 2458 srp[col] ^= RS_RVid;
2459
2460 while (col-- > selection.beg.col && (stp[col] == NOCHAR || unicode::is_space (stp[col])))
2461 srp[col] ^= RS_RVid | RS_Uline;
2462 }
2455 } 2463 }
2456 else 2464 else
2457#endif 2465#endif
2458 { 2466 {
2459 if (selection.beg.row >= -view_start) 2467 if (selection.beg.row >= -view_start)
2886#endif 2894#endif
2887 end_col = ROW(row).is_longer () ? ncol : ROW(row).l; //TODO//FIXME//LEN 2895 end_col = ROW(row).is_longer () ? ncol : ROW(row).l; //TODO//FIXME//LEN
2888 2896
2889 col = max (col, 0); 2897 col = max (col, 0);
2890 2898
2891 if (row == selection.end.row || selection.rect) 2899 if (row == selection.end.row
2900#if ENABLE_FRILLS
2901 || selection.rect
2902#endif
2903 )
2892 end_col = min (end_col, selection.end.col); 2904 min_it (end_col, selection.end.col);
2893 2905
2894 t = ROW(row).t + col; 2906 t = ROW(row).t + col;
2895 for (; col < end_col; col++) 2907 for (; col < end_col; col++)
2896 { 2908 {
2897 if (*t == NOCHAR) 2909 if (*t == NOCHAR)
2915#endif 2927#endif
2916 else 2928 else
2917 new_selection_text[ofs++] = *t++; 2929 new_selection_text[ofs++] = *t++;
2918 } 2930 }
2919 2931
2932#if ENABLE_FRILLS
2933 if (selection.rect)
2934 {
2935 while (ofs
2936 && new_selection_text[ofs - 1] != C0_LF
2937 && unicode::is_space (new_selection_text[ofs - 1]))
2938 --ofs;
2939
2940 new_selection_text[ofs++] = C0_LF;
2941 }
2942 else
2943#endif
2920 if (!ROW(row).is_longer () && row != selection.end.row) 2944 if (!ROW(row).is_longer () && row != selection.end.row)
2921 new_selection_text[ofs++] = C0_LF; 2945 new_selection_text[ofs++] = C0_LF;
2922 } 2946 }
2923 2947
2924 if (end_col != selection.end.col) 2948 if (end_col != selection.end.col)
2925 new_selection_text[ofs++] = C0_LF; 2949 new_selection_text[ofs++] = C0_LF;
2926 2950
3277 selection_delimit_word (DN, &selection.end, &selection.end); 3301 selection_delimit_word (DN, &selection.end, &selection.end);
3278 } 3302 }
3279 else if (selection.clicks == 3) 3303 else if (selection.clicks == 3)
3280 { 3304 {
3281#if ENABLE_FRILLS 3305#if ENABLE_FRILLS
3282 if (options & Opt_tripleclickwords) 3306 if (OPTION (Opt_tripleclickwords))
3283 { 3307 {
3284 selection_delimit_word (UP, &selection.beg, &selection.beg); 3308 selection_delimit_word (UP, &selection.beg, &selection.beg);
3285 3309
3286 for (int end_row = selection.mark.row; end_row < nrow; end_row++) 3310 for (int end_row = selection.mark.row; end_row < nrow; end_row++)
3287 { 3311 {
3348 { 3372 {
3349 stp = ROW(end_row).t; 3373 stp = ROW(end_row).t;
3350 3374
3351 while (--end_col >= 0) 3375 while (--end_col >= 0)
3352 { 3376 {
3353 if (stp[end_col] != ' ' 3377 if (stp[end_col] != NOCHAR
3354 && stp[end_col] != '\t' 3378 && !unicode::is_space (stp[end_col]))
3355 && stp[end_col] != NOCHAR)
3356 break; 3379 break;
3357 } 3380 }
3358 3381
3359 if (end_col >= 0 3382 if (end_col >= 0
3360 || !ROW(end_row - 1).is_longer ()) 3383 || !ROW(end_row - 1).is_longer ())

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines