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.172 by root, Sun Dec 18 00:59:42 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].l == -1) 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].l == -1) 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->l == -1) /* 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;
2978 int ofs = 0; 2983 int ofs = 0;
2979 int extra = 0; 2984 int extra = 0;
2980 2985
2981 for (; row <= end_row; row++, col = 0) 2986 for (; row <= end_row; row++, col = 0)
2982 { 2987 {
2983 end_col = save[row].l;
2984
2985#if ENABLE_FRILLS 2988#if ENABLE_FRILLS
2986 if (selection.rect) 2989 if (selection.rect)
2987 { 2990 {
2988 col = selection.beg.col; 2991 col = selection.beg.col;
2989 end_col = ncol + 1; 2992 end_col = ncol + 1;
2990 } 2993 }
2994 else
2991#endif 2995#endif
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
2995 if (end_col == -1)
2996 end_col = ncol;
2997 2999
2998 if (row == end_row || selection.rect) 3000 if (row == end_row || selection.rect)
2999 MIN_IT (end_col, selection.end.col); 3001 MIN_IT (end_col, selection.end.col);
3000 3002
3001 t = &save[row].t[col]; 3003 t = save[row].t + col;
3002 for (; col < end_col; col++) 3004 for (; col < end_col; col++)
3003 { 3005 {
3004 if (*t == NOCHAR) 3006 if (*t == NOCHAR)
3005 t++; 3007 t++;
3006#if ENABLE_COMBINING 3008#if ENABLE_COMBINING
3022#endif 3024#endif
3023 else 3025 else
3024 new_selection_text[ofs++] = *t++; 3026 new_selection_text[ofs++] = *t++;
3025 } 3027 }
3026 3028
3027 if (save[row].l != -1 && row != end_row) 3029 if (!save[row].is_longer () && row != end_row)
3028 new_selection_text[ofs++] = C0_LF; 3030 new_selection_text[ofs++] = C0_LF;
3029 } 3031 }
3030 3032
3031 if (end_col != selection.end.col) 3033 if (end_col != selection.end.col)
3032 new_selection_text[ofs++] = C0_LF; 3034 new_selection_text[ofs++] = C0_LF;
3149 3151
3150 row = mark->row + saveLines; 3152 row = mark->row + saveLines;
3151 col = mark->col; 3153 col = mark->col;
3152 MAX_IT (col, 0); 3154 MAX_IT (col, 0);
3153 /* find the edge of a word */ 3155 /* find the edge of a word */
3154 stp = &save[row].t[col]; 3156 stp = save[row].t + col; w1 = DELIMIT_TEXT (*stp);
3155 w1 = DELIMIT_TEXT (*stp); 3157 srp = save[row].r + col; w2 = DELIMIT_REND (*srp);
3156
3157 srp = &save[row].r[col];
3158 w2 = DELIMIT_REND (*srp);
3159 3158
3160 for (;;) 3159 for (;;)
3161 { 3160 {
3162 for (; col != bound.col; col += dirnadd) 3161 for (; col != bound.col; col += dirnadd)
3163 { 3162 {
3173 break; 3172 break;
3174 } 3173 }
3175 3174
3176 if ((col == bound.col) && (row != bound.row)) 3175 if ((col == bound.col) && (row != bound.row))
3177 { 3176 {
3178 if (save[ (row - (dirn == UP ? 1 : 0))].l == -1) 3177 if (save[ (row - (dirn == UP ? 1 : 0))].is_longer ())
3179 { 3178 {
3180 trow = row + dirnadd; 3179 trow = row + dirnadd;
3181 tcol = dirn == UP ? ncol - 1 : 0; 3180 tcol = dirn == UP ? ncol - 1 : 0;
3182 3181
3183 if (save[trow].t == NULL) 3182 if (!save[trow].t)
3184 break; 3183 break;
3185 3184
3186 stp = & (save[trow].t[tcol]); 3185 stp = save[trow].t + tcol;
3187 srp = & (save[trow].r[tcol]); 3186 srp = save[trow].r + tcol;
3188 3187
3189 if (DELIMIT_TEXT (*stp) != w1 || DELIMIT_REND (*srp) != w2) 3188 if (DELIMIT_TEXT (*stp) != w1 || DELIMIT_REND (*srp) != w2)
3190 break; 3189 break;
3191 3190
3192 row = trow; 3191 row = trow;
3257 * Extend the selection to the specified col/row 3256 * Extend the selection to the specified col/row
3258 */ 3257 */
3259void 3258void
3260rxvt_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)
3261{ 3260{
3262 int end_col;
3263 row_col_t pos; 3261 row_col_t pos;
3264 enum { 3262 enum {
3265 LEFT, RIGHT 3263 LEFT, RIGHT
3266 } closeto = RIGHT; 3264 } closeto = RIGHT;
3267 3265
3369 } 3367 }
3370 } 3368 }
3371 3369
3372 if (selection.clicks == 1) 3370 if (selection.clicks == 1)
3373 { 3371 {
3374 end_col = save[selection.beg.row + saveLines].l; 3372 if (selection.beg.col > save[selection.beg.row + saveLines].l //TODO//FIXME//LEN
3375 3373 && !save[selection.beg.row + saveLines].is_longer ()
3376 if (selection.beg.col > end_col
3377 && end_col != -1
3378#if ENABLE_FRILLS 3374#if ENABLE_FRILLS
3379 && !selection.rect 3375 && !selection.rect
3380#endif 3376#endif
3381 ) 3377 )
3382 selection.beg.col = ncol; 3378 selection.beg.col = ncol;
3383 3379
3384 end_col = save[selection.end.row + saveLines].l;
3385
3386 if ( 3380 if (
3387 selection.end.col > end_col 3381 selection.end.col > save[selection.end.row + saveLines].l //TODO//FIXME//LEN
3388 && end_col != -1 3382 && !save[selection.end.row + saveLines].is_longer ()
3389#if ENABLE_FRILLS 3383#if ENABLE_FRILLS
3390 && !selection.rect 3384 && !selection.rect
3391#endif 3385#endif
3392 ) 3386 )
3393 selection.end.col = ncol; 3387 selection.end.col = ncol;
3403 else if (selection.clicks == 3) 3397 else if (selection.clicks == 3)
3404 { 3398 {
3405#if ENABLE_FRILLS 3399#if ENABLE_FRILLS
3406 if (options & Opt_tripleclickwords) 3400 if (options & Opt_tripleclickwords)
3407 { 3401 {
3408 int end_row;
3409
3410 selection_delimit_word (UP, &selection.beg, &selection.beg); 3402 selection_delimit_word (UP, &selection.beg, &selection.beg);
3411 end_row = save[selection.mark.row + saveLines].l;
3412 3403
3413 for (end_row = selection.mark.row; end_row < nrow; end_row++) 3404 for (int end_row = selection.mark.row; end_row < nrow; end_row++)
3414 { 3405 {
3415 end_col = save[end_row + saveLines].l; 3406 if (!save[end_row + saveLines].is_longer ())
3416
3417 if (end_col != -1)
3418 { 3407 {
3419 selection.end.row = end_row; 3408 selection.end.row = end_row;
3420 selection.end.col = end_col; 3409 selection.end.col = save[end_row + saveLines].l;
3421 selection_remove_trailing_spaces (); 3410 selection_remove_trailing_spaces ();
3422 break; 3411 break;
3423 } 3412 }
3424 } 3413 }
3425 } 3414 }
3432 selection.beg.col = 0; 3421 selection.beg.col = 0;
3433 selection.end.col = ncol; 3422 selection.end.col = ncol;
3434 3423
3435 // select a complete logical line 3424 // select a complete logical line
3436 while (selection.beg.row > -saveLines 3425 while (selection.beg.row > -saveLines
3437 && save[selection.beg.row - 1 + saveLines].l == -1) 3426 && save[selection.beg.row - 1 + saveLines].is_longer ())
3438 selection.beg.row--; 3427 selection.beg.row--;
3439 3428
3440 while (selection.end.row < nrow 3429 while (selection.end.row < nrow
3441 && save[selection.end.row + saveLines].l == -1) 3430 && save[selection.end.row + saveLines].is_longer ())
3442 selection.end.row++; 3431 selection.end.row++;
3443 } 3432 }
3444 } 3433 }
3445 3434
3446 if (button3 && buttonpress) 3435 if (button3 && buttonpress)
3484 && stp[end_col] != NOCHAR) 3473 && stp[end_col] != NOCHAR)
3485 break; 3474 break;
3486 } 3475 }
3487 3476
3488 if (end_col >= 0 3477 if (end_col >= 0
3489 || save[end_row - 1 + saveLines].l != -1) 3478 || !save[end_row - 1 + saveLines].is_longer ())
3490 { 3479 {
3491 selection.end.col = end_col + 1; 3480 selection.end.col = end_col + 1;
3492 selection.end.row = end_row; 3481 selection.end.row = end_row;
3493 break; 3482 break;
3494 } 3483 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines