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.173 by root, Mon Dec 19 02:16:24 2005 UTC vs.
Revision 1.174 by root, Mon Dec 19 02:40:14 2005 UTC

370 { 370 {
371 if (qrow >= 0) 371 if (qrow >= 0)
372 { 372 {
373 tp [qrow] = (text_t *)ta->alloc (); 373 tp [qrow] = (text_t *)ta->alloc ();
374 rp [qrow] = (rend_t *)ra->alloc (); 374 rp [qrow] = (rend_t *)ra->alloc ();
375 tl [qrow] = -1; 375 tl [qrow] = LINE_CONT1;
376 376
377 int qcol = 0; 377 int qcol = 0;
378 378
379 for (;;) 379 for (;;)
380 { 380 {
812 c = *str++; 812 c = *str++;
813 813
814 if (c < 0x20) 814 if (c < 0x20)
815 if (c == C0_LF) 815 if (c == C0_LF)
816 { 816 {
817 if (line->l != -1) /* XXX: think about this */ 817 if (!line->is_longer ()) /* XXX: think about this */
818 MAX_IT (line->l, screen.cur.col); 818 MAX_IT (line->l, screen.cur.col);
819 819
820 screen.flags &= ~Screen_WrapNext; 820 screen.flags &= ~Screen_WrapNext;
821 821
822 if (screen.cur.row == screen.bscroll) 822 if (screen.cur.row == screen.bscroll)
827 line = save + row; /* _must_ refresh */ 827 line = save + row; /* _must_ refresh */
828 continue; 828 continue;
829 } 829 }
830 else if (c == C0_CR) 830 else if (c == C0_CR)
831 { 831 {
832 if (line->l != -1) /* XXX: think about this */ 832 if (!line->is_longer ()) /* XXX: think about this */
833 MAX_IT (line->l, screen.cur.col); 833 MAX_IT (line->l, screen.cur.col);
834 834
835 screen.flags &= ~Screen_WrapNext; 835 screen.flags &= ~Screen_WrapNext;
836 screen.cur.col = 0; 836 screen.cur.col = 0;
837 continue; 837 continue;
855 CLEAR_SELECTION (); 855 CLEAR_SELECTION ();
856 } 856 }
857 857
858 if (screen.flags & Screen_WrapNext) 858 if (screen.flags & Screen_WrapNext)
859 { 859 {
860 line->l = -1; 860 line->set_is_longer ();
861 861
862 scr_do_wrap (); 862 scr_do_wrap ();
863 863
864 row = screen.cur.row + saveLines; 864 row = screen.cur.row + saveLines;
865 line = save + row; /* _must_ refresh */ 865 line = save + row; /* _must_ refresh */
989 989
990 while (*tp == NOCHAR && tp > line->t) 990 while (*tp == NOCHAR && tp > line->t)
991 tp--, rp--; 991 tp--, rp--;
992 } 992 }
993 else if (screen.cur.row > 0 993 else if (screen.cur.row > 0
994 && save [screen.cur.row - 1 + saveLines].is_cont ()) 994 && save [screen.cur.row - 1 + saveLines].is_longer ())
995 { 995 {
996 line_t *line = save + (screen.cur.row - 1 + saveLines); 996 line_t *line = save + (screen.cur.row - 1 + saveLines);
997 997
998 tp = line->t + last_col - 1; 998 tp = line->t + last_col - 1;
999 rp = line->r + last_col - 1; 999 rp = line->r + last_col - 1;
1013 *rp = SET_FONT (*rp, FONTSET (*rp)->find_font (*tp)); 1013 *rp = SET_FONT (*rp, FONTSET (*rp)->find_font (*tp));
1014#endif 1014#endif
1015 } 1015 }
1016 } 1016 }
1017 1017
1018 if (line->l != -1) /* XXX: think about this */ 1018 if (!line->is_longer ()) /* XXX: think about this */
1019 MAX_IT (line->l, screen.cur.col); 1019 MAX_IT (line->l, screen.cur.col);
1020 1020
1021#ifdef DEBUG_STRICT 1021#ifdef DEBUG_STRICT
1022 assert (screen.cur.row >= 0); 1022 assert (screen.cur.row >= 0);
1023#else /* drive with your eyes closed */ 1023#else /* drive with your eyes closed */
1094 // buffer so they can be selected and pasted. 1094 // buffer so they can be selected and pasted.
1095 if (ht && options & Opt_pastableTabs) 1095 if (ht && options & Opt_pastableTabs)
1096 { 1096 {
1097 base_rend = SET_FONT (base_rend, 0); 1097 base_rend = SET_FONT (base_rend, 0);
1098 1098
1099 if (l.l != -1) /* XXX: think about this */ 1099 if (!l.is_longer ()) /* XXX: think about this */
1100 MAX_IT (l.l, x); 1100 MAX_IT (l.l, x);
1101 1101
1102 i = screen.cur.col; 1102 i = screen.cur.col;
1103 1103
1104 l.t[i] = '\t'; 1104 l.t[i] = '\t';
1142{ 1142{
1143 if (screen.cur.col > 0) 1143 if (screen.cur.col > 0)
1144 scr_gotorc (0, -1, R_RELATIVE | C_RELATIVE); 1144 scr_gotorc (0, -1, R_RELATIVE | C_RELATIVE);
1145 else 1145 else
1146 { 1146 {
1147 if (save[screen.cur.row + saveLines].l == 0) 1147 if (!save[screen.cur.row + saveLines].l)
1148 return; /* um, yeah? */ 1148 return; /* um, yeah? */
1149 1149
1150 scr_insdel_chars (1, INSERT); 1150 scr_insdel_chars (1, INSERT);
1151 } 1151 }
1152} 1152}
1168 scr_gotorc (0, 1, R_RELATIVE | C_RELATIVE); 1168 scr_gotorc (0, 1, R_RELATIVE | C_RELATIVE);
1169 else 1169 else
1170 { 1170 {
1171 row = screen.cur.row + saveLines; 1171 row = screen.cur.row + saveLines;
1172 1172
1173 if (save[row].l == 0) 1173 if (!save[row].l)
1174 return; /* um, yeah? */ 1174 return; /* um, yeah? */
1175 else if (save[row].is_cont ()) 1175
1176 if (save[row].is_longer ()) //TODO//FIXME//LEN
1176 save[row].l = ncol; 1177 save[row].l = ncol;
1177 1178
1178 scr_gotorc (0, 0, R_RELATIVE); 1179 scr_gotorc (0, 0, R_RELATIVE);
1179 scr_insdel_chars (1, DELETE); 1180 scr_insdel_chars (1, DELETE);
1180 scr_gotorc (0, ncol - 1, R_RELATIVE); 1181 scr_gotorc (0, ncol - 1, R_RELATIVE);
1421 selection_check (3); 1422 selection_check (3);
1422 1423
1423 fs = SET_FONT (rstyle, FONTSET (rstyle)->find_font ('E')); 1424 fs = SET_FONT (rstyle, FONTSET (rstyle)->find_font ('E'));
1424 for (k = saveLines, i = nrow; i--; k++) 1425 for (k = saveLines, i = nrow; i--; k++)
1425 { 1426 {
1426 save[k].l = ncol; /* make the `E's selectable */ 1427 line_t &line = save[k];
1428
1427 fill_text (save[k].t, 'E', ncol); 1429 fill_text (line.t, 'E', ncol);
1430
1428 for (r1 = save[k].r, j = ncol; j--; ) 1431 for (r1 = line.r, j = ncol; j--; )
1429 *r1++ = fs; 1432 *r1++ = fs;
1433
1434 line.l = ncol; /* make the `E's selectable */
1430 } 1435 }
1431} 1436}
1432 1437
1433/* ------------------------------------------------------------------------- */ 1438/* ------------------------------------------------------------------------- */
1434/* 1439/*
1492 { 1497 {
1493 line->t[col] = line->t[col - count]; 1498 line->t[col] = line->t[col - count];
1494 line->r[col] = line->r[col - count]; 1499 line->r[col] = line->r[col - count];
1495 } 1500 }
1496 1501
1497 if (line->l != -1) 1502 if (!line->is_longer ())
1498 { 1503 {
1499 line->l += count; 1504 line->l += count;
1500 MIN_IT (line->l, ncol); 1505 MIN_IT (line->l, ncol);
1501 } 1506 }
1502 1507
1533 line->r[col] = line->r[col + count]; 1538 line->r[col] = line->r[col + count];
1534 } 1539 }
1535 1540
1536 scr_blank_line (*line, ncol - count, count, tr); 1541 scr_blank_line (*line, ncol - count, count, tr);
1537 1542
1538 if (line->is_cont ()) /* break line continuation */ 1543 if (line->is_longer ()) /* break line continuation */
1539 line->l = ncol; 1544 line->l = ncol;
1540 1545
1541 line->l -= count; 1546 line->l -= count;
1542 MAX_IT (line->l, 0); 1547 MAX_IT (line->l, 0);
1543 1548
1976 wctomb (0, 0); 1981 wctomb (0, 0);
1977 1982
1978 for (r1 = 0; r1 < nrows; r1++) 1983 for (r1 = 0; r1 < nrows; r1++)
1979 { 1984 {
1980 text_t *tp = save[r1 + row_offset].t; 1985 text_t *tp = save[r1 + row_offset].t;
1981 int len = save[r1 + row_offset].l; 1986 int len = save[r1 + row_offset].l;
1982 1987
1983 for (i = len >= 0 ? len : ncol - 1; i--; ) 1988 for (i = len >= 0 ? len : ncol - 1; i--; ) //TODO//FIXME//LEN
1984 { 1989 {
1985 char mb[MB_LEN_MAX]; 1990 char mb[MB_LEN_MAX];
1986 text_t t = *tp++; 1991 text_t t = *tp++;
1987 if (t == NOCHAR) 1992 if (t == NOCHAR)
1988 continue; 1993 continue;
2986 col = selection.beg.col; 2991 col = selection.beg.col;
2987 end_col = ncol + 1; 2992 end_col = ncol + 1;
2988 } 2993 }
2989 else 2994 else
2990#endif 2995#endif
2991 end_col = save[row].is_cont () ? ncol : save[row].l; //TODO//FIXME 2996 end_col = save[row].is_longer () ? ncol : save[row].l; //TODO//FIXME//LEN
2992 2997
2993 MAX_IT (col, 0); 2998 MAX_IT (col, 0);
2994 2999
2995 if (row == end_row || selection.rect) 3000 if (row == end_row || selection.rect)
2996 MIN_IT (end_col, selection.end.col); 3001 MIN_IT (end_col, selection.end.col);
2997 3002
2998 t = &save[row].t[col]; 3003 t = save[row].t + col;
2999 for (; col < end_col; col++) 3004 for (; col < end_col; col++)
3000 { 3005 {
3001 if (*t == NOCHAR) 3006 if (*t == NOCHAR)
3002 t++; 3007 t++;
3003#if ENABLE_COMBINING 3008#if ENABLE_COMBINING
3019#endif 3024#endif
3020 else 3025 else
3021 new_selection_text[ofs++] = *t++; 3026 new_selection_text[ofs++] = *t++;
3022 } 3027 }
3023 3028
3024 if (save[row].l != -1 && row != end_row) 3029 if (!save[row].is_longer () && row != end_row)
3025 new_selection_text[ofs++] = C0_LF; 3030 new_selection_text[ofs++] = C0_LF;
3026 } 3031 }
3027 3032
3028 if (end_col != selection.end.col) 3033 if (end_col != selection.end.col)
3029 new_selection_text[ofs++] = C0_LF; 3034 new_selection_text[ofs++] = C0_LF;
3146 3151
3147 row = mark->row + saveLines; 3152 row = mark->row + saveLines;
3148 col = mark->col; 3153 col = mark->col;
3149 MAX_IT (col, 0); 3154 MAX_IT (col, 0);
3150 /* find the edge of a word */ 3155 /* find the edge of a word */
3151 stp = &save[row].t[col]; 3156 stp = save[row].t + col; w1 = DELIMIT_TEXT (*stp);
3152 w1 = DELIMIT_TEXT (*stp); 3157 srp = save[row].r + col; w2 = DELIMIT_REND (*srp);
3153
3154 srp = &save[row].r[col];
3155 w2 = DELIMIT_REND (*srp);
3156 3158
3157 for (;;) 3159 for (;;)
3158 { 3160 {
3159 for (; col != bound.col; col += dirnadd) 3161 for (; col != bound.col; col += dirnadd)
3160 { 3162 {
3170 break; 3172 break;
3171 } 3173 }
3172 3174
3173 if ((col == bound.col) && (row != bound.row)) 3175 if ((col == bound.col) && (row != bound.row))
3174 { 3176 {
3175 if (save[ (row - (dirn == UP ? 1 : 0))].is_cont ()) 3177 if (save[ (row - (dirn == UP ? 1 : 0))].is_longer ())
3176 { 3178 {
3177 trow = row + dirnadd; 3179 trow = row + dirnadd;
3178 tcol = dirn == UP ? ncol - 1 : 0; 3180 tcol = dirn == UP ? ncol - 1 : 0;
3179 3181
3180 if (save[trow].t == NULL) 3182 if (!save[trow].t)
3181 break; 3183 break;
3182 3184
3183 stp = & (save[trow].t[tcol]); 3185 stp = save[trow].t + tcol;
3184 srp = & (save[trow].r[tcol]); 3186 srp = save[trow].r + tcol;
3185 3187
3186 if (DELIMIT_TEXT (*stp) != w1 || DELIMIT_REND (*srp) != w2) 3188 if (DELIMIT_TEXT (*stp) != w1 || DELIMIT_REND (*srp) != w2)
3187 break; 3189 break;
3188 3190
3189 row = trow; 3191 row = trow;
3254 * Extend the selection to the specified col/row 3256 * Extend the selection to the specified col/row
3255 */ 3257 */
3256void 3258void
3257rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int buttonpress, int clickchange) 3259rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int buttonpress, int clickchange)
3258{ 3260{
3259 int end_col;
3260 row_col_t pos; 3261 row_col_t pos;
3261 enum { 3262 enum {
3262 LEFT, RIGHT 3263 LEFT, RIGHT
3263 } closeto = RIGHT; 3264 } closeto = RIGHT;
3264 3265
3366 } 3367 }
3367 } 3368 }
3368 3369
3369 if (selection.clicks == 1) 3370 if (selection.clicks == 1)
3370 { 3371 {
3371 end_col = save[selection.beg.row + saveLines].l; 3372 if (selection.beg.col > save[selection.beg.row + saveLines].l //TODO//FIXME//LEN
3372 3373 && !save[selection.beg.row + saveLines].is_longer ()
3373 if (selection.beg.col > end_col
3374 && end_col != -1
3375#if ENABLE_FRILLS 3374#if ENABLE_FRILLS
3376 && !selection.rect 3375 && !selection.rect
3377#endif 3376#endif
3378 ) 3377 )
3379 selection.beg.col = ncol; 3378 selection.beg.col = ncol;
3380 3379
3381 end_col = save[selection.end.row + saveLines].l;
3382
3383 if ( 3380 if (
3384 selection.end.col > end_col 3381 selection.end.col > save[selection.end.row + saveLines].l //TODO//FIXME//LEN
3385 && end_col != -1 3382 && !save[selection.end.row + saveLines].is_longer ()
3386#if ENABLE_FRILLS 3383#if ENABLE_FRILLS
3387 && !selection.rect 3384 && !selection.rect
3388#endif 3385#endif
3389 ) 3386 )
3390 selection.end.col = ncol; 3387 selection.end.col = ncol;
3400 else if (selection.clicks == 3) 3397 else if (selection.clicks == 3)
3401 { 3398 {
3402#if ENABLE_FRILLS 3399#if ENABLE_FRILLS
3403 if (options & Opt_tripleclickwords) 3400 if (options & Opt_tripleclickwords)
3404 { 3401 {
3405 int end_row;
3406
3407 selection_delimit_word (UP, &selection.beg, &selection.beg); 3402 selection_delimit_word (UP, &selection.beg, &selection.beg);
3408 end_row = save[selection.mark.row + saveLines].l;
3409 3403
3410 for (end_row = selection.mark.row; end_row < nrow; end_row++) 3404 for (int end_row = selection.mark.row; end_row < nrow; end_row++)
3411 { 3405 {
3412 end_col = save[end_row + saveLines].l; 3406 if (!save[end_row + saveLines].is_longer ())
3413
3414 if (end_col != -1)
3415 { 3407 {
3416 selection.end.row = end_row; 3408 selection.end.row = end_row;
3417 selection.end.col = end_col; 3409 selection.end.col = save[end_row + saveLines].l;
3418 selection_remove_trailing_spaces (); 3410 selection_remove_trailing_spaces ();
3419 break; 3411 break;
3420 } 3412 }
3421 } 3413 }
3422 } 3414 }
3429 selection.beg.col = 0; 3421 selection.beg.col = 0;
3430 selection.end.col = ncol; 3422 selection.end.col = ncol;
3431 3423
3432 // select a complete logical line 3424 // select a complete logical line
3433 while (selection.beg.row > -saveLines 3425 while (selection.beg.row > -saveLines
3434 && save[selection.beg.row - 1 + saveLines].is_cont ()) 3426 && save[selection.beg.row - 1 + saveLines].is_longer ())
3435 selection.beg.row--; 3427 selection.beg.row--;
3436 3428
3437 while (selection.end.row < nrow 3429 while (selection.end.row < nrow
3438 && save[selection.end.row + saveLines].is_cont ()) 3430 && save[selection.end.row + saveLines].is_longer ())
3439 selection.end.row++; 3431 selection.end.row++;
3440 } 3432 }
3441 } 3433 }
3442 3434
3443 if (button3 && buttonpress) 3435 if (button3 && buttonpress)
3481 && stp[end_col] != NOCHAR) 3473 && stp[end_col] != NOCHAR)
3482 break; 3474 break;
3483 } 3475 }
3484 3476
3485 if (end_col >= 0 3477 if (end_col >= 0
3486 || save[end_row - 1 + saveLines].l != -1) 3478 || !save[end_row - 1 + saveLines].is_longer ())
3487 { 3479 {
3488 selection.end.col = end_col + 1; 3480 selection.end.col = end_col + 1;
3489 selection.end.row = end_row; 3481 selection.end.row = end_row;
3490 break; 3482 break;
3491 } 3483 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines