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.175 by root, Tue Dec 20 19:30:59 2005 UTC vs.
Revision 1.178 by root, Tue Dec 20 22:27:49 2005 UTC

83#define ROWCOL_IN_ROW_AT_OR_AFTER(X, Y) \ 83#define ROWCOL_IN_ROW_AT_OR_AFTER(X, Y) \
84 ROW_AND_COL_IN_ROW_AT_OR_AFTER ((X).row, (X).col, (Y).row, (Y).col) 84 ROW_AND_COL_IN_ROW_AT_OR_AFTER ((X).row, (X).col, (Y).row, (Y).col)
85#define ROWCOL_IN_ROW_AT_OR_BEFORE(X, Y) \ 85#define ROWCOL_IN_ROW_AT_OR_BEFORE(X, Y) \
86 ROW_AND_COL_IN_ROW_AT_OR_BEFORE ((X).row, (X).col, (Y).row, (Y).col) 86 ROW_AND_COL_IN_ROW_AT_OR_BEFORE ((X).row, (X).col, (Y).row, (Y).col)
87 87
88#define LINENO(n) (((n) + term_start + total_rows) % total_rows)
89#define ROW(n) (save [LINENO (n)])
90
91/* 88/*
92 * CLEAR_ROWS : clear <num> rows starting from row <row> 89 * CLEAR_ROWS : clear <num> rows starting from row <row>
93 * CLEAR_CHARS: clear <num> chars starting from pixel position <x,y> 90 * CLEAR_CHARS: clear <num> chars starting from pixel position <x,y>
94 * ERASE_ROWS : set <num> rows starting from row <row> to the foreground colour 91 * ERASE_ROWS : set <num> rows starting from row <row> to the foreground colour
95 */ 92 */
251 if (nrow < prev_nrow) 248 if (nrow < prev_nrow)
252 { 249 {
253 /* delete rows */ 250 /* delete rows */
254 k = min (nsaved, prev_nrow - nrow); 251 k = min (nsaved, prev_nrow - nrow);
255 // k = max (0, - ( (nrow - 1) - r->screen.cur.row)); // mmc's http://maruska.dyndns.org/wiki/scrolling-bug //make configurable? //D TODO 252 // k = max (0, - ( (nrow - 1) - r->screen.cur.row)); // mmc's http://maruska.dyndns.org/wiki/scrolling-bug //make configurable? //D TODO
256 scr_scroll_text (0, (int)prev_nrow - 1, k, 1); 253 scr_scroll_text (0, (int)prev_nrow - 1, k);
257 254
258 for (p = nrow; p < prev_nrow; p++) 255 for (p = nrow; p < prev_nrow; p++)
259 { 256 {
260 lfree (ROW(p)); 257 lfree (ROW(p));
261 lfree (swap_save[p]); 258 lfree (swap_save[p]);
289 drawn[p].clear (); scr_blank_screen_mem (drawn[p], DEFAULT_RSTYLE); 286 drawn[p].clear (); scr_blank_screen_mem (drawn[p], DEFAULT_RSTYLE);
290 } 287 }
291 288
292 if (k > 0) 289 if (k > 0)
293 { 290 {
294 scr_scroll_text (0, (int)nrow - 1, -k, 1); 291 scr_scroll_text (0, (int)nrow - 1, -k);
295 screen.cur.row += k; 292 screen.cur.row += k;
296 screen.s_cur.row += k; 293 screen.s_cur.row += k;
297 nsaved -= k; 294 nsaved -= k;
298 } 295 }
299 296
538 * XTERM_SEQ: Secondary screen: ESC [ ? 4 7 l 535 * XTERM_SEQ: Secondary screen: ESC [ ? 4 7 l
539 */ 536 */
540int 537int
541rxvt_term::scr_change_screen (int scrn) 538rxvt_term::scr_change_screen (int scrn)
542{ 539{
543 int i;
544#if NSCREENS
545 int offset;
546#endif
547
548 want_refresh = 1; 540 want_refresh = 1;
549
550 view_start = 0; 541 view_start = 0;
551 542
552 if (current_screen == scrn) 543 if (current_screen == scrn)
553 return scrn; 544 return scrn;
554 545
555 selection_check (2); /* check for boundary cross */ 546 selection_check (2); /* check for boundary cross */
556 547
557 i = current_screen; current_screen = scrn; scrn = i; 548 SWAP_IT (scrn, current_screen, int);
558 549
559 SWAP_IT (screen.cur.row, swap.cur.row, int16_t); 550 SWAP_IT (screen.cur.row, swap.cur.row, int16_t);
560 SWAP_IT (screen.cur.col, swap.cur.col, int16_t); 551 SWAP_IT (screen.cur.col, swap.cur.col, int16_t);
561 MAX_IT (screen.cur.row, 0); 552 MAX_IT (screen.cur.row, 0);
562 MIN_IT (screen.cur.row, (int32_t)prev_nrow - 1); 553 MIN_IT (screen.cur.row, (int32_t)prev_nrow - 1);
565 556
566#if NSCREENS 557#if NSCREENS
567 if (options & Opt_secondaryScreen) 558 if (options & Opt_secondaryScreen)
568 { 559 {
569 num_scr = 0; 560 num_scr = 0;
570 offset = saveLines;
571 561
572 for (i = prev_nrow; i--;) 562 for (int i = nrow; i--; )
573 SWAP_IT (ROW(i), swap_save[i], line_t); 563 SWAP_IT (ROW(i), swap_save[i], line_t);
574 564
575 SWAP_IT (screen.charset, swap.charset, int16_t); 565 SWAP_IT (screen.charset, swap.charset, int16_t);
576 SWAP_IT (screen.flags, swap.flags, int); 566 SWAP_IT (screen.flags, swap.flags, int);
577 screen.flags |= Screen_VisibleCursor; 567 screen.flags |= Screen_VisibleCursor;
578 swap.flags |= Screen_VisibleCursor; 568 swap.flags |= Screen_VisibleCursor;
579 } 569 }
580 else 570 else
581#endif 571#endif
582 if (options & Opt_secondaryScroll) 572 if (options & Opt_secondaryScroll)
583 scr_scroll_text (0, prev_nrow - 1, prev_nrow, 0); 573 scr_scroll_text (0, prev_nrow - 1, prev_nrow);
584 574
585 return scrn; 575 return scrn;
586} 576}
587 577
588// clear WrapNext indicator, solidifying position on next line 578// clear WrapNext indicator, solidifying position on next line
595 screen.flags &= ~Screen_WrapNext; 585 screen.flags &= ~Screen_WrapNext;
596 586
597 screen.cur.col = 0; 587 screen.cur.col = 0;
598 588
599 if (screen.cur.row == screen.bscroll) 589 if (screen.cur.row == screen.bscroll)
600 scr_scroll_text (screen.tscroll, screen.bscroll, 1, 0); 590 scr_scroll_text (screen.tscroll, screen.bscroll, 1);
601 else if (screen.cur.row < nrow - 1) 591 else if (screen.cur.row < nrow - 1)
602 screen.cur.row++; 592 screen.cur.row++;
603} 593}
604 594
605/* ------------------------------------------------------------------------- */ 595/* ------------------------------------------------------------------------- */
636/* ------------------------------------------------------------------------- */ 626/* ------------------------------------------------------------------------- */
637/* 627/*
638 * Scroll text between <row1> and <row2> inclusive, by <count> lines 628 * Scroll text between <row1> and <row2> inclusive, by <count> lines
639 * count positive ==> scroll up 629 * count positive ==> scroll up
640 * count negative ==> scroll down 630 * count negative ==> scroll down
641 * spec == 0 for normal routines
642 */ 631 */
643int 632int
644rxvt_term::scr_scroll_text (int row1, int row2, int count, int spec) 633rxvt_term::scr_scroll_text (int row1, int row2, int count)
645{ 634{
646 int i, j;
647
648 if (count == 0 || (row1 > row2)) 635 if (count == 0 || (row1 > row2))
649 return 0; 636 return 0;
650 637
651 want_refresh = 1; 638 want_refresh = 1;
639 num_scr += count;
652 640
653 if (row1 == 0 && count > 0 641 if (count > 0
642 && row1 == 0
643 && row2 == nrow - 1
654 && (current_screen == PRIMARY || options & Opt_secondaryScroll)) 644 && (current_screen == PRIMARY || options & Opt_secondaryScroll))
655 { 645 {
656 nsaved = min (nsaved + count, saveLines); 646 nsaved = min (nsaved + count, saveLines);
657 term_start = (term_start + count) % total_rows; 647 term_start = (term_start + count) % total_rows;
658 648
659 if (selection.op && current_screen == selection.screen) 649 if (selection.op && current_screen == selection.screen)
660 { 650 {
661 selection.beg.row -= count; 651 selection.beg.row -= count;
662 selection.end.row -= count; 652 selection.end.row -= count;
663 selection.mark.row -= count; 653 selection.mark.row -= count;
654
655 selection_check (0);
664 } 656 }
665 657
666 for (int i = count; i--; ) 658 for (int i = count; i--; )
667 scr_blank_screen_mem (ROW(row2 - i), rstyle); 659 scr_blank_screen_mem (ROW(row2 - i), rstyle);
668 660
671 && view_start != saveLines) 663 && view_start != saveLines)
672 scr_page (UP, count); 664 scr_page (UP, count);
673 } 665 }
674 else 666 else
675 { 667 {
676 if (!spec)
677 row1 += saveLines;
678
679 row2 += saveLines;
680
681 if (selection.op && current_screen == selection.screen) 668 if (selection.op && current_screen == selection.screen)
682 { 669 {
683 i = selection.beg.row + saveLines; 670 int i = selection.beg.row;
684 j = selection.end.row + saveLines; 671 int j = selection.end.row;
685 672
686 if ((i < row1 && j > row1) 673 if ((i < row1 && j > row1)
687 || (i < row2 && j > row2) 674 || (i < row2 && j > row2)
688 || (i - count < row1 && i >= row1) 675 || (i - count < row1 && i >= row1)
689 || (i - count > row2 && i <= row2) 676 || (i - count > row2 && i <= row2)
697 { 684 {
698 /* move selected region too */ 685 /* move selected region too */
699 selection.beg.row -= count; 686 selection.beg.row -= count;
700 selection.end.row -= count; 687 selection.end.row -= count;
701 selection.mark.row -= count; 688 selection.mark.row -= count;
689
690 selection_check (0);
702 } 691 }
703 } 692 }
704 693
705 selection_check (0); /* _after_ nsaved update */ 694 // use a simple and robust scrolling algorithm, this
695 // part of scr_scroll_text is not time-critical.
706 696
707 num_scr += count;
708 j = count;
709
710 if (count < 0)
711 count = -count;
712
713 i = row2 - row1 + 1; 697 int rows = row2 - row1 + 1;
714 MIN_IT (count, i);
715 698
716 if (j > 0) 699 for (int row = 0; row < rows; row++)
717 {
718 /* scroll up */
719
720 /* Copy lines that will get clobbered by the rotation */
721 memcpy (buf, save + row1, count * sizeof (line_t));
722
723 /* Rotate lines */
724 i = row2 - row1 - count + 1;
725 memmove (save + row1, save + row1 + count, i * sizeof (line_t));
726
727 j = row2 - count + 1, i = count;
728 } 700 {
729 else /* if (j < 0) */ 701 buf [row] = ROW(row1 + (row + count + rows) % rows);
702
703 if (!IN_RANGE_EXC (row + count, 0, rows))
704 scr_blank_screen_mem (buf [row], rstyle);
730 { 705 }
731 /* scroll down */
732 706
733 /* Copy lines that will get clobbered by the rotation */ 707 for (int row = 0; row < rows; row++)
734 for (i = 0, j = row2; i < count; i++, j--) 708 ROW(row1 + row) = buf [row];
735 buf[i] = save[j];
736
737 /* Rotate lines */
738 for (j = row2, i = j - count; i >= row1; i--, j--)
739 save[j] = save[i];
740
741 j = row1, i = count;
742 count = -count;
743 }
744
745 /* Resurrect lines */
746 memcpy (save + j, buf, i * sizeof (line_t));
747
748 if (!spec) /* line length may not equal ncol */
749 for (; i--; j++)
750 scr_blank_screen_mem (save[j], rstyle);
751 } 709 }
752 710
753 return count; 711 return count;
754} 712}
755 713
778 if ((nlines > 0) 736 if ((nlines > 0)
779 && (screen.tscroll == 0) 737 && (screen.tscroll == 0)
780 && (screen.bscroll == (nrow - 1))) 738 && (screen.bscroll == (nrow - 1)))
781 { 739 {
782 /* _at least_ this many lines need to be scrolled */ 740 /* _at least_ this many lines need to be scrolled */
783 scr_scroll_text (screen.tscroll, screen.bscroll, nlines, 0); 741 scr_scroll_text (screen.tscroll, screen.bscroll, nlines);
784 screen.cur.row -= nlines; 742 screen.cur.row -= nlines;
785 } 743 }
786 } 744 }
787 745
788#ifdef DEBUG_STRICT 746#ifdef DEBUG_STRICT
811 MAX_IT (line->l, screen.cur.col); 769 MAX_IT (line->l, screen.cur.col);
812 770
813 screen.flags &= ~Screen_WrapNext; 771 screen.flags &= ~Screen_WrapNext;
814 772
815 if (screen.cur.row == screen.bscroll) 773 if (screen.cur.row == screen.bscroll)
816 scr_scroll_text (screen.tscroll, screen.bscroll, 1, 0); 774 scr_scroll_text (screen.tscroll, screen.bscroll, 1);
817 else if (screen.cur.row < (nrow - 1)) 775 else if (screen.cur.row < (nrow - 1))
818 row = ++screen.cur.row; 776 row = ++screen.cur.row;
819 777
820 line = &ROW(row); /* _must_ refresh */ 778 line = &ROW(row); /* _must_ refresh */
821 continue; 779 continue;
1234 1192
1235 screen.flags &= ~Screen_WrapNext; 1193 screen.flags &= ~Screen_WrapNext;
1236 1194
1237 if ((screen.cur.row == screen.bscroll && direction == UP) 1195 if ((screen.cur.row == screen.bscroll && direction == UP)
1238 || (screen.cur.row == screen.tscroll && direction == DN)) 1196 || (screen.cur.row == screen.tscroll && direction == DN))
1239 scr_scroll_text (screen.tscroll, screen.bscroll, dirn, 0); 1197 scr_scroll_text (screen.tscroll, screen.bscroll, dirn);
1240 else 1198 else
1241 screen.cur.row += dirn; 1199 screen.cur.row += dirn;
1242 1200
1243 MAX_IT (screen.cur.row, 0); 1201 MAX_IT (screen.cur.row, 0);
1244 MIN_IT (screen.cur.row, (int32_t)nrow - 1); 1202 MIN_IT (screen.cur.row, (int32_t)nrow - 1);
1305 */ 1263 */
1306void 1264void
1307rxvt_term::scr_erase_screen (int mode) 1265rxvt_term::scr_erase_screen (int mode)
1308{ 1266{
1309 int num; 1267 int num;
1310 int32_t row, row_offset; 1268 int32_t row;
1311 rend_t ren; 1269 rend_t ren;
1312 XGCValues gcvalue; 1270 XGCValues gcvalue;
1313 1271
1314 want_refresh = 1; 1272 want_refresh = 1;
1315 ZERO_SCROLLBACK (); 1273 ZERO_SCROLLBACK ();
1316
1317 row_offset = (int32_t)saveLines;
1318 1274
1319 switch (mode) 1275 switch (mode)
1320 { 1276 {
1321 case 0: /* erase to end of screen */ 1277 case 0: /* erase to end of screen */
1322 selection_check (1); 1278 selection_check (1);
1367 XChangeGC (display->display, gc, GCForeground, &gcvalue); 1323 XChangeGC (display->display, gc, GCForeground, &gcvalue);
1368 } 1324 }
1369 1325
1370 for (; num--; row++) 1326 for (; num--; row++)
1371 { 1327 {
1372 scr_blank_screen_mem (save[row + row_offset], rstyle); 1328 scr_blank_screen_mem (ROW (row), rstyle);
1373 save[row + row_offset].l = 0; 1329 ROW (row).l = 0;
1374 scr_blank_line (drawn[row], 0, ncol, ren); 1330 scr_blank_line (drawn[row], 0, ncol, ren);
1375 } 1331 }
1376} 1332}
1377 1333
1378#if ENABLE_FRILLS 1334#if ENABLE_FRILLS
1392 * XTERM_SEQ: Screen Alignment Test: ESC # 8 1348 * XTERM_SEQ: Screen Alignment Test: ESC # 8
1393 */ 1349 */
1394void 1350void
1395rxvt_term::scr_E () 1351rxvt_term::scr_E ()
1396{ 1352{
1397 int i, j, k;
1398 rend_t *r1, fs; 1353 rend_t fs;
1399 1354
1400 want_refresh = 1; 1355 want_refresh = 1;
1401 ZERO_SCROLLBACK (); 1356 ZERO_SCROLLBACK ();
1402 1357
1403 num_scr_allow = 0; 1358 num_scr_allow = 0;
1404 selection_check (3); 1359 selection_check (3);
1405 1360
1406 fs = SET_FONT (rstyle, FONTSET (rstyle)->find_font ('E')); 1361 fs = SET_FONT (rstyle, FONTSET (rstyle)->find_font ('E'));
1407 for (k = saveLines, i = nrow; i--; k++) 1362 for (int row = nrow; row--; )
1408 { 1363 {
1409 line_t &line = save[k]; 1364 line_t &line = ROW(row);
1410 1365
1411 fill_text (line.t, 'E', ncol); 1366 fill_text (line.t, 'E', ncol);
1367 rend_t *r1 = line.r;
1412 1368
1413 for (r1 = line.r, j = ncol; j--; ) 1369 for (int j = ncol; j--; )
1414 *r1++ = fs; 1370 *r1++ = fs;
1415 1371
1416 line.l = ncol; /* make the `E's selectable */ 1372 line.l = ncol; /* make the `E's selectable */
1417 } 1373 }
1418} 1374}
1442 count = end; 1398 count = end;
1443 } 1399 }
1444 1400
1445 scr_do_wrap (); 1401 scr_do_wrap ();
1446 1402
1447 scr_scroll_text (screen.cur.row, screen.bscroll, insdel * count, 0); 1403 scr_scroll_text (screen.cur.row, screen.bscroll, insdel * count);
1448} 1404}
1449 1405
1450/* ------------------------------------------------------------------------- */ 1406/* ------------------------------------------------------------------------- */
1451/* 1407/*
1452 * Insert/Delete <count> characters from the current position 1408 * Insert/Delete <count> characters from the current position
1466 scr_do_wrap (); 1422 scr_do_wrap ();
1467 1423
1468 selection_check (1); 1424 selection_check (1);
1469 MIN_IT (count, (ncol - screen.cur.col)); 1425 MIN_IT (count, (ncol - screen.cur.col));
1470 1426
1471 row = screen.cur.row + saveLines; 1427 row = screen.cur.row;
1472 1428
1473 line_t *line = save + row; 1429 line_t *line = &ROW(row);
1474 1430
1475 switch (insdel) 1431 switch (insdel)
1476 { 1432 {
1477 case INSERT: 1433 case INSERT:
1478 for (col = ncol - 1; (col - count) >= screen.cur.col; col--) 1434 for (col = ncol - 1; (col - count) >= screen.cur.col; col--)
1499 selection.mark.col += count; /* XXX: yes? */ 1455 selection.mark.col += count; /* XXX: yes? */
1500 selection.end.col += count; 1456 selection.end.col += count;
1501 } 1457 }
1502 } 1458 }
1503 1459
1504 scr_blank_line (save[row], screen.cur.col, count, rstyle); 1460 scr_blank_line (*line, screen.cur.col, count, rstyle);
1505 break; 1461 break;
1506 1462
1507 case ERASE: 1463 case ERASE:
1508 screen.cur.col += count; /* don't worry if > ncol */ 1464 screen.cur.col += count; /* don't worry if > ncol */
1509 selection_check (1); 1465 selection_check (1);
1510 screen.cur.col -= count; 1466 screen.cur.col -= count;
1511 scr_blank_line (save[row], screen.cur.col, count, rstyle); 1467 scr_blank_line (*line, screen.cur.col, count, rstyle);
1512 break; 1468 break;
1513 1469
1514 case DELETE: 1470 case DELETE:
1515 tr = line->r[ncol - 1] & (RS_fgMask | RS_bgMask | RS_baseattrMask); 1471 tr = line->r[ncol - 1] & (RS_fgMask | RS_bgMask | RS_baseattrMask);
1516 1472
1523 scr_blank_line (*line, ncol - count, count, tr); 1479 scr_blank_line (*line, ncol - count, count, tr);
1524 1480
1525 if (line->is_longer ()) /* break line continuation */ 1481 if (line->is_longer ()) /* break line continuation */
1526 line->l = ncol; 1482 line->l = ncol;
1527 1483
1528 line->l -= count; 1484 line->l = max (line->l - count, 0);
1529 MAX_IT (line->l, 0);
1530 1485
1531 if (selection.op && current_screen == selection.screen 1486 if (selection.op && current_screen == selection.screen
1532 && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)) 1487 && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur))
1533 { 1488 {
1534 if (selection.end.row != screen.cur.row 1489 if (selection.end.row != screen.cur.row
1941/* ARGSUSED */ 1896/* ARGSUSED */
1942void 1897void
1943rxvt_term::scr_printscreen (int fullhist) 1898rxvt_term::scr_printscreen (int fullhist)
1944{ 1899{
1945#ifdef PRINTPIPE 1900#ifdef PRINTPIPE
1946 int i, r1, nrows, row_offset; 1901 int nrows, row_start;
1947 FILE *fd; 1902 FILE *fd;
1948 1903
1949 if ((fd = popen_printer ()) == NULL) 1904 if ((fd = popen_printer ()) == NULL)
1950 return; 1905 return;
1951 1906
1952 nrows = nrow;
1953 row_offset = saveLines;
1954
1955 if (!fullhist) 1907 if (fullhist)
1956 row_offset -= view_start; 1908 {
1909 nrows = nrow + nsaved;
1910 row_start = -nsaved;
1911 }
1957 else 1912 else
1958 { 1913 {
1959 nrows += nsaved; 1914 nrows = nrow;
1960 row_offset -= nsaved; 1915 row_start = -view_start;
1961 } 1916 }
1962 1917
1963 wctomb (0, 0); 1918 wctomb (0, 0);
1964 1919
1965 for (r1 = 0; r1 < nrows; r1++) 1920 for (int r1 = 0; r1 < nrows; r1++)
1966 { 1921 {
1967 text_t *tp = save[r1 + row_offset].t; 1922 text_t *tp = ROW(r1).t;
1968 int len = save[r1 + row_offset].l; 1923 int len = ROW(r1).l;
1969 1924
1970 for (i = len >= 0 ? len : ncol - 1; i--; ) //TODO//FIXME//LEN 1925 for (int i = len >= 0 ? len : ncol - 1; i--; ) //TODO//FIXME//LEN
1971 { 1926 {
1972 char mb[MB_LEN_MAX]; 1927 char mb[MB_LEN_MAX];
1973 text_t t = *tp++; 1928 text_t t = *tp++;
1974 if (t == NOCHAR) 1929 if (t == NOCHAR)
1975 continue; 1930 continue;
2135 * D: CopyArea pass - very useful for slower links 2090 * D: CopyArea pass - very useful for slower links
2136 * This has been deliberately kept simple. 2091 * This has been deliberately kept simple.
2137 */ 2092 */
2138 i = num_scr; 2093 i = num_scr;
2139 if (!display->is_local 2094 if (!display->is_local
2140 && refresh_type == FAST_REFRESH && num_scr_allow && i 2095 && refresh_type == FAST_REFRESH && num_scr_allow && num_scr
2141 && abs (i) < nrow && !must_clear) 2096 && abs (num_scr) < nrow && !must_clear)
2142 { 2097 {
2143 int16_t nits; 2098 int16_t nits;
2144 int j; 2099 int j;
2145 int len, wlen; 2100 int len, wlen;
2146 2101
2149 row = i > 0 ? 0 : j - 1; 2104 row = i > 0 ? 0 : j - 1;
2150 for (; j-- >= 0; row += (i > 0 ? 1 : -1)) 2105 for (; j-- >= 0; row += (i > 0 ? 1 : -1))
2151 { 2106 {
2152 if (row + i >= 0 && row + i < nrow && row + i != ocrow) 2107 if (row + i >= 0 && row + i < nrow && row + i != ocrow)
2153 { 2108 {
2154 line_t s = save[(row + row_offset) % nlines]; 2109 line_t s = save[(row + row_offset) % total_rows];
2155 line_t d = drawn[row]; 2110 line_t d = drawn[row];
2156 line_t d2 = drawn[row + i]; 2111 line_t d2 = drawn[row + i];
2157 2112
2158 for (nits = 0, col = ncol; col--; ) 2113 for (nits = 0, col = ncol; col--; )
2159 if (s.t[col] != d2.t[col] || s.r[col] != d2.r[col]) 2114 if (s.t[col] != d2.t[col] || s.r[col] != d2.r[col])
3189 * flag == 2 ==> button 3 motion 3144 * flag == 2 ==> button 3 motion
3190 */ 3145 */
3191void 3146void
3192rxvt_term::selection_extend (int x, int y, int flag) 3147rxvt_term::selection_extend (int x, int y, int flag)
3193{ 3148{
3194 int col = min (max (Pixel2Col (x), 0), nrow - 1); 3149 int col = min (max (Pixel2Col (x), 0), ncol);
3195 int row = min (max (Pixel2Row (y), 0), ncol); 3150 int row = min (max (Pixel2Row (y), 0), nrow - 1);
3196 3151
3197 /* 3152 /*
3198 * If we're selecting characters (single click) then we must check first 3153 * If we're selecting characters (single click) then we must check first
3199 * if we are at the same place as the original mark. If we are then 3154 * if we are at the same place as the original mark. If we are then
3200 * select nothing. Otherwise, if we're to the right of the mark, you have to 3155 * select nothing. Otherwise, if we're to the right of the mark, you have to
3371 for (int end_row = selection.mark.row; end_row < nrow; end_row++) 3326 for (int end_row = selection.mark.row; end_row < nrow; end_row++)
3372 { 3327 {
3373 if (!ROW(end_row).is_longer ()) 3328 if (!ROW(end_row).is_longer ())
3374 { 3329 {
3375 selection.end.row = end_row; 3330 selection.end.row = end_row;
3376 selection.end.col = save[end_row + saveLines].l; 3331 selection.end.col = ROW(end_row).l;
3377 selection_remove_trailing_spaces (); 3332 selection_remove_trailing_spaces ();
3378 break; 3333 break;
3379 } 3334 }
3380 } 3335 }
3381 } 3336 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines