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.195 by root, Mon Dec 26 23:02:34 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() \
351 lofs += len; 351 lofs += len;
352 qcol += len; 352 qcol += len;
353 } 353 }
354 } 354 }
355 355
356 qline->l = llen < ncol ? llen : MOD (llen - 1, ncol) + 1; 356 qline->l = llen ? MOD (llen - 1, ncol) + 1 : 0;
357#ifdef DEBUG_STRICT //TODO//FIXME//TEMPORARY
358 if (qline->l < 0)
359 {
357 printf ("qline->l %d = llen %d < ncol %d ? %d : MOD %d\n", qline->l,llen,ncol,llen,MOD (llen - 1, ncol) + 1);//D 360 fprintf (stderr, "ERROR, PLEASE REPORT to rxvt-unicode@plan9.de: qline->l %d = llen %d < ncol %d ? %d : MOD %d\n", qline->l,llen,ncol,llen,MOD (llen - 1, ncol) + 1);//D
361 qline->l = 0;
362 }
363#endif
358 scr_blank_line (*qline, qline->l, ncol - qline->l, DEFAULT_RSTYLE); 364 scr_blank_line (*qline, qline->l, ncol - qline->l, DEFAULT_RSTYLE);
359 } 365 }
360 while (p != pend && q > 0); 366 while (p != pend && q > 0);
361 367
362 term_start = total_rows - nrow; 368 term_start = total_rows - nrow;
524 530
525 screen.cur.row = clamp (screen.cur.row, 0, prev_nrow - 1); 531 screen.cur.row = clamp (screen.cur.row, 0, prev_nrow - 1);
526 screen.cur.col = clamp (screen.cur.col, 0, prev_ncol - 1); 532 screen.cur.col = clamp (screen.cur.col, 0, prev_ncol - 1);
527 533
528#if NSCREENS 534#if NSCREENS
529 if (options & Opt_secondaryScreen) 535 if (OPTION (Opt_secondaryScreen))
530 { 536 {
531 num_scr = 0; 537 num_scr = 0;
532 538
533 for (int i = prev_nrow; i--; ) 539 for (int i = prev_nrow; i--; )
534 ::swap (ROW(i), swap_buf [i]); 540 ::swap (ROW(i), swap_buf [i]);
538 screen.flags |= Screen_VisibleCursor; 544 screen.flags |= Screen_VisibleCursor;
539 swap.flags |= Screen_VisibleCursor; 545 swap.flags |= Screen_VisibleCursor;
540 } 546 }
541 else 547 else
542#endif 548#endif
543 if (options & Opt_secondaryScroll) 549 if (OPTION (Opt_secondaryScroll))
544 scr_scroll_text (0, prev_nrow - 1, prev_nrow); 550 scr_scroll_text (0, prev_nrow - 1, prev_nrow);
545 551
546 return scrn; 552 return scrn;
547} 553}
548 554
610 num_scr += count; 616 num_scr += count;
611 617
612 if (count > 0 618 if (count > 0
613 && row1 == 0 619 && row1 == 0
614 && row2 == nrow - 1 620 && row2 == nrow - 1
615 && (current_screen == PRIMARY || options & Opt_secondaryScroll)) 621 && (current_screen == PRIMARY || OPTION (Opt_secondaryScroll)))
616 { 622 {
617 nsaved = min (nsaved + count, saveLines); 623 nsaved = min (nsaved + count, saveLines);
618 term_start = (term_start + count) % total_rows; 624 term_start = (term_start + count) % total_rows;
619 625
620 if (selection.op && current_screen == selection.screen) 626 if (selection.op && current_screen == selection.screen)
636 { 642 {
637 ROW(row2 - i).l = 0; 643 ROW(row2 - i).l = 0;
638 scr_blank_screen_mem (ROW(row2 - i), rstyle); 644 scr_blank_screen_mem (ROW(row2 - i), rstyle);
639 } 645 }
640 646
641 if ((options & Opt_scrollWithBuffer) 647 if (OPTION (Opt_scrollWithBuffer)
642 && view_start != 0 648 && view_start != 0
643 && view_start != saveLines) 649 && view_start != saveLines)
644 scr_page (UP, count); 650 scr_page (UP, count);
645 } 651 }
646 else 652 else
1012 if (count) 1018 if (count)
1013 x = ncol - 1; 1019 x = ncol - 1;
1014 1020
1015 // store horizontal tab commands as characters inside the text 1021 // store horizontal tab commands as characters inside the text
1016 // buffer so they can be selected and pasted. 1022 // buffer so they can be selected and pasted.
1017 if (ht && options & Opt_pastableTabs) 1023 if (ht && OPTION (Opt_pastableTabs))
1018 { 1024 {
1019 base_rend = SET_FONT (base_rend, 0); 1025 base_rend = SET_FONT (base_rend, 0);
1020 1026
1021 if (!l.is_longer ()) /* XXX: think about this */ 1027 if (!l.is_longer ()) /* XXX: think about this */
1022 max_it (l.l, x); 1028 max_it (l.l, x);
1278 CLEAR_ROWS (row, num); 1284 CLEAR_ROWS (row, num);
1279 } 1285 }
1280 else 1286 else
1281 { 1287 {
1282 ren = rstyle & (RS_fgMask | RS_bgMask); 1288 ren = rstyle & (RS_fgMask | RS_bgMask);
1283 gcvalue.foreground = pix_colors[GET_BGCOLOR (rstyle)]; 1289 gcvalue.foreground = pix_colors[bgcolor_of (rstyle)];
1284 XChangeGC (display->display, gc, GCForeground, &gcvalue); 1290 XChangeGC (display->display, gc, GCForeground, &gcvalue);
1285 ERASE_ROWS (row, num); 1291 ERASE_ROWS (row, num);
1286 gcvalue.foreground = pix_colors[Color_fg]; 1292 gcvalue.foreground = pix_colors[Color_fg];
1287 XChangeGC (display->display, gc, GCForeground, &gcvalue); 1293 XChangeGC (display->display, gc, GCForeground, &gcvalue);
1288 } 1294 }
1587 ::swap (pix_colors[Color_fg], pix_colors[Color_bg]); 1593 ::swap (pix_colors[Color_fg], pix_colors[Color_bg]);
1588#if XPM_BACKGROUND 1594#if XPM_BACKGROUND
1589 if (bgPixmap.pixmap == None) 1595 if (bgPixmap.pixmap == None)
1590#endif 1596#endif
1591#if TRANSPARENT 1597#if TRANSPARENT
1592 if (! (options & Opt_transparent) || am_transparent == 0) 1598 if (! OPTION (Opt_transparent) || am_transparent == 0)
1593#endif 1599#endif
1594 XSetWindowBackground (display->display, vt, 1600 XSetWindowBackground (display->display, vt,
1595 pix_colors[Color_bg]); 1601 pix_colors[Color_bg]);
1596 1602
1597 gcvalue.foreground = pix_colors[Color_fg]; 1603 gcvalue.foreground = pix_colors[Color_fg];
1830{ 1836{
1831#ifndef NO_BELL 1837#ifndef NO_BELL
1832 1838
1833# ifndef NO_MAPALERT 1839# ifndef NO_MAPALERT
1834# ifdef MAPALERT_OPTION 1840# ifdef MAPALERT_OPTION
1835 if (options & Opt_mapAlert) 1841 if (OPTION (Opt_mapAlert))
1836# endif 1842# endif
1837 XMapWindow (display->display, parent[0]); 1843 XMapWindow (display->display, parent[0]);
1838# endif 1844# endif
1839 1845
1840 if (options & Opt_visualBell) 1846 if (OPTION (Opt_visualBell))
1841 { 1847 {
1842 scr_rvideo_mode (!rvideo); /* refresh also done */ 1848 scr_rvideo_mode (!rvideo); /* refresh also done */
1843 rxvt_usleep (VISUAL_BELL_DURATION); 1849 rxvt_usleep (VISUAL_BELL_DURATION);
1844 scr_rvideo_mode (!rvideo); /* refresh also done */ 1850 scr_rvideo_mode (!rvideo); /* refresh also done */
1845 } 1851 }
1936 1942
1937#if XPM_BACKGROUND 1943#if XPM_BACKGROUND
1938 must_clear |= bgPixmap.pixmap != None; 1944 must_clear |= bgPixmap.pixmap != None;
1939#endif 1945#endif
1940#if TRANSPARENT 1946#if TRANSPARENT
1941 must_clear |= (options & Opt_transparent) && am_transparent; 1947 must_clear |= OPTION (Opt_transparent) && am_transparent;
1942#endif 1948#endif
1943 ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ 1949 ocrow = oldcursor.row; /* is there an old outline cursor on screen? */
1944 1950
1945 /* 1951 /*
1946 * B: reverse any characters which are selected 1952 * B: reverse any characters which are selected
1970 1976
1971 crp = &ROW(screen.cur.row).r[col]; 1977 crp = &ROW(screen.cur.row).r[col];
1972 1978
1973 if (showcursor && focus) 1979 if (showcursor && focus)
1974 { 1980 {
1975 if (options & Opt_cursorUnderline) 1981 if (OPTION (Opt_cursorUnderline))
1976 *crp ^= RS_Uline; 1982 *crp ^= RS_Uline;
1977 else 1983 else
1978 { 1984 {
1979 *crp ^= RS_RVid; 1985 *crp ^= RS_RVid;
1980 1986
1982 cc1 = *crp & (RS_fgMask | RS_bgMask); 1988 cc1 = *crp & (RS_fgMask | RS_bgMask);
1983 if (ISSET_PIXCOLOR (Color_cursor)) 1989 if (ISSET_PIXCOLOR (Color_cursor))
1984 ccol1 = Color_cursor; 1990 ccol1 = Color_cursor;
1985 else 1991 else
1986#ifdef CURSOR_COLOR_IS_RENDITION_COLOR 1992#ifdef CURSOR_COLOR_IS_RENDITION_COLOR
1987 ccol1 = GET_FGCOLOR (rstyle); 1993 ccol1 = fgcolor_of (rstyle);
1988#else 1994#else
1989 ccol1 = Color_fg; 1995 ccol1 = Color_fg;
1990#endif 1996#endif
1991 if (ISSET_PIXCOLOR (Color_cursor2)) 1997 if (ISSET_PIXCOLOR (Color_cursor2))
1992 ccol2 = Color_cursor2; 1998 ccol2 = Color_cursor2;
1993 else 1999 else
1994#ifdef CURSOR_COLOR_IS_RENDITION_COLOR 2000#ifdef CURSOR_COLOR_IS_RENDITION_COLOR
1995 ccol2 = GET_BGCOLOR (rstyle); 2001 ccol2 = bgcolor_of (rstyle);
1996#else 2002#else
1997 ccol2 = Color_bg; 2003 ccol2 = Color_bg;
1998#endif 2004#endif
1999 *crp = SET_FGCOLOR (*crp, ccol1); 2005 *crp = SET_FGCOLOR (*crp, ccol1);
2000 *crp = SET_BGCOLOR (*crp, ccol2); 2006 *crp = SET_BGCOLOR (*crp, ccol2);
2181 count++, i--; 2187 count++, i--;
2182 2188
2183 /* 2189 /*
2184 * Determine the attributes for the string 2190 * Determine the attributes for the string
2185 */ 2191 */
2186 int fore = GET_FGCOLOR (rend); // desired foreground 2192 int fore = fgcolor_of (rend); // desired foreground
2187 int back = GET_BGCOLOR (rend); // desired background 2193 int back = bgcolor_of (rend); // desired background
2188 2194
2189 // only do special processing if any attributes are set, which is rare 2195 // only do special processing if any attributes are set, which is unlikely
2190 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))
2191 { 2197 {
2192#if ENABLE_STYLES 2198#if ENABLE_STYLES
2193 // force redraw after "careful" characters to avoid pixel droppings 2199 // force redraw after "careful" characters to avoid pixel droppings
2194 if (srp[col] & RS_Careful && col < ncol - 1 && 0) 2200 if (srp[col] & RS_Careful && col < ncol - 1 && 0)
2313 */ 2319 */
2314 if (showcursor) 2320 if (showcursor)
2315 { 2321 {
2316 if (focus) 2322 if (focus)
2317 { 2323 {
2318 if (options & Opt_cursorUnderline) 2324 if (OPTION (Opt_cursorUnderline))
2319 *crp ^= RS_Uline; 2325 *crp ^= RS_Uline;
2320 else 2326 else
2321 { 2327 {
2322 *crp ^= RS_RVid; 2328 *crp ^= RS_RVid;
2323#ifndef NO_CURSORCOLOR 2329#ifndef NO_CURSORCOLOR
2442 2448
2443#if ENABLE_FRILLS 2449#if ENABLE_FRILLS
2444 if (selection.rect) 2450 if (selection.rect)
2445 { 2451 {
2446 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
2447 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++)
2448 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 }
2449 } 2463 }
2450 else 2464 else
2451#endif 2465#endif
2452 { 2466 {
2453 if (selection.beg.row >= -view_start) 2467 if (selection.beg.row >= -view_start)
2880#endif 2894#endif
2881 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
2882 2896
2883 col = max (col, 0); 2897 col = max (col, 0);
2884 2898
2885 if (row == selection.end.row || selection.rect) 2899 if (row == selection.end.row
2900#if ENABLE_FRILLS
2901 || selection.rect
2902#endif
2903 )
2886 end_col = min (end_col, selection.end.col); 2904 min_it (end_col, selection.end.col);
2887 2905
2888 t = ROW(row).t + col; 2906 t = ROW(row).t + col;
2889 for (; col < end_col; col++) 2907 for (; col < end_col; col++)
2890 { 2908 {
2891 if (*t == NOCHAR) 2909 if (*t == NOCHAR)
2909#endif 2927#endif
2910 else 2928 else
2911 new_selection_text[ofs++] = *t++; 2929 new_selection_text[ofs++] = *t++;
2912 } 2930 }
2913 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
2914 if (!ROW(row).is_longer () && row != selection.end.row) 2944 if (!ROW(row).is_longer () && row != selection.end.row)
2915 new_selection_text[ofs++] = C0_LF; 2945 new_selection_text[ofs++] = C0_LF;
2916 } 2946 }
2917 2947
2918 if (end_col != selection.end.col) 2948 if (end_col != selection.end.col)
2919 new_selection_text[ofs++] = C0_LF; 2949 new_selection_text[ofs++] = C0_LF;
2920 2950
3271 selection_delimit_word (DN, &selection.end, &selection.end); 3301 selection_delimit_word (DN, &selection.end, &selection.end);
3272 } 3302 }
3273 else if (selection.clicks == 3) 3303 else if (selection.clicks == 3)
3274 { 3304 {
3275#if ENABLE_FRILLS 3305#if ENABLE_FRILLS
3276 if (options & Opt_tripleclickwords) 3306 if (OPTION (Opt_tripleclickwords))
3277 { 3307 {
3278 selection_delimit_word (UP, &selection.beg, &selection.beg); 3308 selection_delimit_word (UP, &selection.beg, &selection.beg);
3279 3309
3280 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++)
3281 { 3311 {
3342 { 3372 {
3343 stp = ROW(end_row).t; 3373 stp = ROW(end_row).t;
3344 3374
3345 while (--end_col >= 0) 3375 while (--end_col >= 0)
3346 { 3376 {
3347 if (stp[end_col] != ' ' 3377 if (stp[end_col] != NOCHAR
3348 && stp[end_col] != '\t' 3378 && !unicode::is_space (stp[end_col]))
3349 && stp[end_col] != NOCHAR)
3350 break; 3379 break;
3351 } 3380 }
3352 3381
3353 if (end_col >= 0 3382 if (end_col >= 0
3354 || !ROW(end_row - 1).is_longer ()) 3383 || !ROW(end_row - 1).is_longer ())
3670 for (int y = ov_h; y--; ) 3699 for (int y = ov_h; y--; )
3671 { 3700 {
3672 text_t *t1 = ov_text[y]; 3701 text_t *t1 = ov_text[y];
3673 rend_t *r1 = ov_rend[y]; 3702 rend_t *r1 = ov_rend[y];
3674 3703
3675 text_t *t2 = ROW(y - view_start).t + ov_x; 3704 text_t *t2 = ROW(y + ov_y - view_start).t + ov_x;
3676 rend_t *r2 = ROW(y - view_start).r + ov_x; 3705 rend_t *r2 = ROW(y + ov_y - view_start).r + ov_x;
3677 3706
3678 for (int x = ov_w; x--; ) 3707 for (int x = ov_w; x--; )
3679 { 3708 {
3680 text_t t = *t1; *t1++ = *t2; *t2++ = t; 3709 text_t t = *t1; *t1++ = *t2; *t2++ = t;
3681 rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, FONTSET (r)->find_font (t)); 3710 rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, FONTSET (r)->find_font (t));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines