… | |
… | |
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() \ |
… | |
… | |
280 | if (nsaved) |
280 | if (nsaved) |
281 | { |
281 | { |
282 | // re-wrap lines, this is rather ugly, possibly because I am too dumb |
282 | // re-wrap lines, this is rather ugly, possibly because I am too dumb |
283 | // to come up with a lean and mean algorithm. |
283 | // to come up with a lean and mean algorithm. |
284 | |
284 | |
285 | while (p != pend && q > 0) |
285 | row_col_t ocur = screen.cur; |
|
|
286 | ocur.row = MOD (term_start + ocur.row, prev_total_rows); |
|
|
287 | |
|
|
288 | do |
286 | { |
289 | { |
287 | p = MOD (p - 1, prev_total_rows); |
290 | p = MOD (p - 1, prev_total_rows); |
288 | #ifdef DEBUG_STRICT |
291 | #ifdef DEBUG_STRICT |
289 | assert (old_buf [MOD (p, prev_total_rows)].t); |
292 | assert (old_buf [MOD (p, prev_total_rows)].t); |
290 | #endif |
293 | #endif |
291 | |
294 | |
|
|
295 | int plines = 1; |
292 | int llen = old_buf [MOD (p, prev_total_rows)].l; |
296 | int llen = old_buf [MOD (p, prev_total_rows)].l; |
293 | |
297 | |
294 | while (p != pend && old_buf [MOD (p - 1, prev_total_rows)].is_longer ()) |
298 | while (p != pend && old_buf [MOD (p - 1, prev_total_rows)].is_longer ()) |
295 | { |
299 | { |
296 | p = MOD (p - 1, prev_total_rows); |
300 | p = MOD (p - 1, prev_total_rows); |
297 | |
301 | |
|
|
302 | plines++; |
298 | llen += prev_ncol; |
303 | llen += prev_ncol; |
299 | } |
304 | } |
300 | |
305 | |
301 | int qlines = max (0, (llen - 1) / ncol) + 1; |
306 | int qlines = max (0, (llen - 1) / ncol) + 1; |
302 | |
307 | |
… | |
… | |
322 | while (lofs < llen && qcol < ncol) |
327 | while (lofs < llen && qcol < ncol) |
323 | { |
328 | { |
324 | int prow = lofs / prev_ncol; |
329 | int prow = lofs / prev_ncol; |
325 | int pcol = lofs % prev_ncol; |
330 | int pcol = lofs % prev_ncol; |
326 | |
331 | |
327 | line_t &pline = old_buf [MOD (p + prow, prev_total_rows)]; |
332 | prow = MOD (p + prow, prev_total_rows); |
|
|
333 | |
|
|
334 | // we only adjust the cursor _row_ and put it into |
|
|
335 | // the topmost line of "long line" it was in, as |
|
|
336 | // this seems to upset applications/shells/readline |
|
|
337 | // least. |
|
|
338 | if (prow == ocur.row) |
|
|
339 | screen.cur.row = q - (total_rows - nrow); |
|
|
340 | |
|
|
341 | line_t &pline = old_buf [prow]; |
328 | |
342 | |
329 | int len = min (min (prev_ncol - pcol, ncol - qcol), llen - lofs); |
343 | int len = min (min (prev_ncol - pcol, ncol - qcol), llen - lofs); |
330 | |
344 | |
331 | assert (len); |
345 | assert (len); |
332 | assert (pline.t); |
346 | assert (pline.t); |
… | |
… | |
337 | lofs += len; |
351 | lofs += len; |
338 | qcol += len; |
352 | qcol += len; |
339 | } |
353 | } |
340 | } |
354 | } |
341 | |
355 | |
342 | 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 | { |
|
|
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 |
343 | scr_blank_line (*qline, qline->l, ncol - qline->l, DEFAULT_RSTYLE); |
364 | scr_blank_line (*qline, qline->l, ncol - qline->l, DEFAULT_RSTYLE); |
344 | } |
365 | } |
|
|
366 | while (p != pend && q > 0); |
345 | |
367 | |
346 | term_start = total_rows - nrow; |
368 | term_start = total_rows - nrow; |
347 | view_start = 0; |
|
|
348 | nsaved = term_start - q; |
369 | nsaved = term_start - q; |
349 | |
370 | |
350 | // make sure all terminal lines exist |
371 | // make sure all terminal lines exist |
351 | while (nsaved < 0) |
372 | while (nsaved < 0) |
352 | scr_blank_screen_mem (ROW (-++nsaved), DEFAULT_RSTYLE); |
373 | scr_blank_screen_mem (ROW (-++nsaved), DEFAULT_RSTYLE); |
… | |
… | |
369 | { |
390 | { |
370 | row_buf [row].clear (); scr_blank_screen_mem (row_buf [row], DEFAULT_RSTYLE); |
391 | row_buf [row].clear (); scr_blank_screen_mem (row_buf [row], DEFAULT_RSTYLE); |
371 | } |
392 | } |
372 | |
393 | |
373 | term_start = 0; |
394 | term_start = 0; |
374 | view_start = 0; |
|
|
375 | } |
395 | } |
376 | |
396 | |
377 | #ifdef DEBUG_STRICT |
397 | #ifdef DEBUG_STRICT //TODO: remove |
378 | for (int i = -nsaved; i < nrow; i++) |
398 | for (int i = -nsaved; i < nrow; i++) |
379 | assert (ROW (i).t); |
399 | assert (ROW (i).t); |
380 | #endif |
400 | #endif |
381 | |
401 | |
382 | free (old_buf); |
402 | free (old_buf); |
… | |
… | |
510 | |
530 | |
511 | screen.cur.row = clamp (screen.cur.row, 0, prev_nrow - 1); |
531 | screen.cur.row = clamp (screen.cur.row, 0, prev_nrow - 1); |
512 | screen.cur.col = clamp (screen.cur.col, 0, prev_ncol - 1); |
532 | screen.cur.col = clamp (screen.cur.col, 0, prev_ncol - 1); |
513 | |
533 | |
514 | #if NSCREENS |
534 | #if NSCREENS |
515 | if (options & Opt_secondaryScreen) |
535 | if (OPTION (Opt_secondaryScreen)) |
516 | { |
536 | { |
517 | num_scr = 0; |
537 | num_scr = 0; |
518 | |
538 | |
519 | for (int i = prev_nrow; i--; ) |
539 | for (int i = prev_nrow; i--; ) |
520 | ::swap (ROW(i), swap_buf [i]); |
540 | ::swap (ROW(i), swap_buf [i]); |
… | |
… | |
524 | screen.flags |= Screen_VisibleCursor; |
544 | screen.flags |= Screen_VisibleCursor; |
525 | swap.flags |= Screen_VisibleCursor; |
545 | swap.flags |= Screen_VisibleCursor; |
526 | } |
546 | } |
527 | else |
547 | else |
528 | #endif |
548 | #endif |
529 | if (options & Opt_secondaryScroll) |
549 | if (OPTION (Opt_secondaryScroll)) |
530 | scr_scroll_text (0, prev_nrow - 1, prev_nrow); |
550 | scr_scroll_text (0, prev_nrow - 1, prev_nrow); |
531 | |
551 | |
532 | return scrn; |
552 | return scrn; |
533 | } |
553 | } |
534 | |
554 | |
… | |
… | |
596 | num_scr += count; |
616 | num_scr += count; |
597 | |
617 | |
598 | if (count > 0 |
618 | if (count > 0 |
599 | && row1 == 0 |
619 | && row1 == 0 |
600 | && row2 == nrow - 1 |
620 | && row2 == nrow - 1 |
601 | && (current_screen == PRIMARY || options & Opt_secondaryScroll)) |
621 | && (current_screen == PRIMARY || OPTION (Opt_secondaryScroll))) |
602 | { |
622 | { |
603 | nsaved = min (nsaved + count, saveLines); |
623 | nsaved = min (nsaved + count, saveLines); |
604 | term_start = (term_start + count) % total_rows; |
624 | term_start = (term_start + count) % total_rows; |
605 | |
625 | |
606 | if (selection.op && current_screen == selection.screen) |
626 | if (selection.op && current_screen == selection.screen) |
607 | { |
627 | { |
608 | selection.beg.row -= count; |
628 | selection.beg.row -= count; |
609 | selection.end.row -= count; |
629 | selection.end.row -= count; |
610 | selection.mark.row -= count; |
630 | selection.mark.row -= count; |
611 | |
631 | |
612 | selection_check (0); |
632 | if (selection.beg.row < -nsaved |
|
|
633 | || selection.end.row < -nsaved |
|
|
634 | || selection.mark.row < -nsaved) |
|
|
635 | { |
|
|
636 | CLEAR_ALL_SELECTION (); |
|
|
637 | selection.op = SELECTION_CLEAR; |
|
|
638 | } |
613 | } |
639 | } |
614 | |
640 | |
615 | for (int i = count; i--; ) |
641 | for (int i = count; i--; ) |
|
|
642 | { |
|
|
643 | ROW(row2 - i).l = 0; |
616 | scr_blank_screen_mem (ROW(row2 - i), rstyle); |
644 | scr_blank_screen_mem (ROW(row2 - i), rstyle); |
|
|
645 | } |
617 | |
646 | |
618 | if ((options & Opt_scrollWithBuffer) |
647 | if (OPTION (Opt_scrollWithBuffer) |
619 | && view_start != 0 |
648 | && view_start != 0 |
620 | && view_start != saveLines) |
649 | && view_start != saveLines) |
621 | scr_page (UP, count); |
650 | scr_page (UP, count); |
622 | } |
651 | } |
623 | else |
652 | else |
624 | { |
653 | { |
625 | if (selection.op && current_screen == selection.screen) |
654 | if (selection.op && current_screen == selection.screen) |
626 | { |
655 | { |
627 | int i = selection.beg.row; |
656 | if ((selection.beg.row < row1 && selection.end.row > row1) |
628 | int j = selection.end.row; |
657 | || (selection.beg.row < row2 && selection.end.row > row2) |
629 | |
|
|
630 | if ((i < row1 && j > row1) |
|
|
631 | || (i < row2 && j > row2) |
|
|
632 | || (i - count < row1 && i >= row1) |
658 | || (selection.beg.row - count < row1 && selection.beg.row >= row1) |
633 | || (i - count > row2 && i <= row2) |
659 | || (selection.beg.row - count > row2 && selection.beg.row <= row2) |
634 | || (j - count < row1 && j >= row1) |
660 | || (selection.end.row - count < row1 && selection.end.row >= row1) |
635 | || (j - count > row2 && j <= row2)) |
661 | || (selection.end.row - count > row2 && selection.end.row <= row2)) |
636 | { |
662 | { |
637 | CLEAR_ALL_SELECTION (); |
663 | CLEAR_ALL_SELECTION (); |
638 | selection.op = SELECTION_CLEAR; /* XXX: too aggressive? */ |
664 | selection.op = SELECTION_CLEAR; |
639 | } |
665 | } |
640 | else if (j >= row1 && j <= row2) |
666 | else if (selection.end.row >= row1 && selection.end.row <= row2) |
641 | { |
667 | { |
642 | /* move selected region too */ |
668 | /* move selected region too */ |
643 | selection.beg.row -= count; |
669 | selection.beg.row -= count; |
644 | selection.end.row -= count; |
670 | selection.end.row -= count; |
645 | selection.mark.row -= count; |
671 | selection.mark.row -= count; |
… | |
… | |
680 | if (len <= 0) /* sanity */ |
706 | if (len <= 0) /* sanity */ |
681 | return; |
707 | return; |
682 | |
708 | |
683 | unsigned char checksel; |
709 | unsigned char checksel; |
684 | unicode_t c; |
710 | unicode_t c; |
685 | int row, last_col; |
711 | int last_col; |
686 | const unicode_t *strend = str + len; |
712 | const unicode_t *strend = str + len; |
687 | |
713 | |
688 | want_refresh = 1; |
714 | want_refresh = 1; |
689 | ZERO_SCROLLBACK (); |
715 | ZERO_SCROLLBACK (); |
690 | last_col = ncol; |
716 | last_col = ncol; |
… | |
… | |
705 | #ifdef DEBUG_STRICT |
731 | #ifdef DEBUG_STRICT |
706 | assert (screen.cur.col < last_col); |
732 | assert (screen.cur.col < last_col); |
707 | assert (screen.cur.row < nrow |
733 | assert (screen.cur.row < nrow |
708 | && screen.cur.row >= -nsaved); |
734 | && screen.cur.row >= -nsaved); |
709 | #endif |
735 | #endif |
710 | row = screen.cur.row; |
736 | int row = screen.cur.row; |
711 | |
737 | |
712 | checksel = selection.op && current_screen == selection.screen ? 1 : 0; |
738 | checksel = selection.op && current_screen == selection.screen ? 1 : 0; |
713 | |
739 | |
714 | line_t *line = &ROW(row); |
740 | line_t *line = &ROW(row); |
715 | |
741 | |
… | |
… | |
717 | { |
743 | { |
718 | c = *str++; |
744 | c = *str++; |
719 | |
745 | |
720 | if (c < 0x20) |
746 | if (c < 0x20) |
721 | if (c == C0_LF) |
747 | if (c == C0_LF) |
722 | { |
748 | { |
723 | if (!line->is_longer ()) /* XXX: think about this */ |
749 | if (!line->is_longer ()) /* XXX: think about this */ |
724 | max_it (line->l, screen.cur.col); |
750 | max_it (line->l, screen.cur.col); |
725 | |
751 | |
726 | screen.flags &= ~Screen_WrapNext; |
752 | screen.flags &= ~Screen_WrapNext; |
727 | |
753 | |
… | |
… | |
972 | |
998 | |
973 | if (count == 0) |
999 | if (count == 0) |
974 | return; |
1000 | return; |
975 | else if (count > 0) |
1001 | else if (count > 0) |
976 | { |
1002 | { |
977 | int row = screen.cur.row; |
|
|
978 | |
|
|
979 | line_t &l = ROW(row); |
1003 | line_t &l = ROW(screen.cur.row); |
980 | rend_t base_rend = l.r[i]; |
1004 | rend_t base_rend = l.r[i]; |
981 | ht &= l.t[i] == ' '; |
1005 | ht &= l.t[i] == ' '; |
982 | |
1006 | |
983 | for (; ++i < ncol; ) |
1007 | for (; ++i < ncol; ) |
984 | if (tabs[i]) |
1008 | if (tabs[i]) |
… | |
… | |
994 | if (count) |
1018 | if (count) |
995 | x = ncol - 1; |
1019 | x = ncol - 1; |
996 | |
1020 | |
997 | // store horizontal tab commands as characters inside the text |
1021 | // store horizontal tab commands as characters inside the text |
998 | // buffer so they can be selected and pasted. |
1022 | // buffer so they can be selected and pasted. |
999 | if (ht && options & Opt_pastableTabs) |
1023 | if (ht && OPTION (Opt_pastableTabs)) |
1000 | { |
1024 | { |
1001 | base_rend = SET_FONT (base_rend, 0); |
1025 | base_rend = SET_FONT (base_rend, 0); |
1002 | |
1026 | |
1003 | if (!l.is_longer ()) /* XXX: think about this */ |
1027 | if (!l.is_longer ()) /* XXX: think about this */ |
1004 | max_it (l.l, x); |
1028 | max_it (l.l, x); |
… | |
… | |
1059 | */ |
1083 | */ |
1060 | #if ENABLE_FRILLS |
1084 | #if ENABLE_FRILLS |
1061 | void |
1085 | void |
1062 | rxvt_term::scr_forwardindex () |
1086 | rxvt_term::scr_forwardindex () |
1063 | { |
1087 | { |
1064 | int row; |
|
|
1065 | |
|
|
1066 | if (screen.cur.col < ncol - 1) |
1088 | if (screen.cur.col < ncol - 1) |
1067 | scr_gotorc (0, 1, R_RELATIVE | C_RELATIVE); |
1089 | scr_gotorc (0, 1, R_RELATIVE | C_RELATIVE); |
1068 | else |
1090 | else |
1069 | { |
1091 | { |
1070 | row = screen.cur.row; |
|
|
1071 | |
|
|
1072 | if (ROW(row).is_longer ()) //TODO//FIXME//LEN |
1092 | if (ROW(screen.cur.row).is_longer ()) //TODO//FIXME//LEN |
1073 | ROW(row).l = ncol; |
1093 | ROW(screen.cur.row).l = ncol; |
1074 | |
1094 | |
1075 | scr_gotorc (0, 0, R_RELATIVE); |
1095 | scr_gotorc (0, 0, R_RELATIVE); |
1076 | scr_insdel_chars (1, DELETE); |
1096 | scr_insdel_chars (1, DELETE); |
1077 | scr_gotorc (0, ncol - 1, R_RELATIVE); |
1097 | scr_gotorc (0, ncol - 1, R_RELATIVE); |
1078 | } |
1098 | } |
… | |
… | |
1161 | * XTERM_SEQ: Clear whole line : ESC [ 2 K |
1181 | * XTERM_SEQ: Clear whole line : ESC [ 2 K |
1162 | */ |
1182 | */ |
1163 | void |
1183 | void |
1164 | rxvt_term::scr_erase_line (int mode) |
1184 | rxvt_term::scr_erase_line (int mode) |
1165 | { |
1185 | { |
1166 | unsigned int row, col, num; |
1186 | unsigned int col, num; |
1167 | |
1187 | |
1168 | want_refresh = 1; |
1188 | want_refresh = 1; |
1169 | ZERO_SCROLLBACK (); |
1189 | ZERO_SCROLLBACK (); |
1170 | |
1190 | |
1171 | selection_check (1); |
1191 | selection_check (1); |
1172 | |
1192 | |
1173 | row = screen.cur.row; |
1193 | line_t &line = ROW(screen.cur.row); |
1174 | |
1194 | |
1175 | switch (mode) |
1195 | switch (mode) |
1176 | { |
1196 | { |
1177 | case 0: /* erase to end of line */ |
1197 | case 0: /* erase to end of line */ |
1178 | col = screen.cur.col; |
1198 | col = screen.cur.col; |
1179 | num = ncol - col; |
1199 | num = ncol - col; |
1180 | min_it (ROW(row).l, col); |
1200 | min_it (line.l, col); |
1181 | if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur) |
1201 | if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur) |
1182 | || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur)) |
1202 | || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur)) |
1183 | CLEAR_SELECTION (); |
1203 | CLEAR_SELECTION (); |
1184 | break; |
1204 | break; |
1185 | case 1: /* erase to beginning of line */ |
1205 | case 1: /* erase to beginning of line */ |
… | |
… | |
1190 | CLEAR_SELECTION (); |
1210 | CLEAR_SELECTION (); |
1191 | break; |
1211 | break; |
1192 | case 2: /* erase whole line */ |
1212 | case 2: /* erase whole line */ |
1193 | col = 0; |
1213 | col = 0; |
1194 | num = ncol; |
1214 | num = ncol; |
1195 | ROW(row).l = 0; |
1215 | line.l = 0; |
1196 | if (selection.beg.row <= screen.cur.row |
1216 | if (selection.beg.row <= screen.cur.row |
1197 | && selection.end.row >= screen.cur.row) |
1217 | && selection.end.row >= screen.cur.row) |
1198 | CLEAR_SELECTION (); |
1218 | CLEAR_SELECTION (); |
1199 | break; |
1219 | break; |
1200 | default: |
1220 | default: |
1201 | return; |
1221 | return; |
1202 | } |
1222 | } |
1203 | |
1223 | |
1204 | scr_blank_line (ROW(row), col, num, rstyle); |
1224 | scr_blank_line (line, col, num, rstyle); |
1205 | } |
1225 | } |
1206 | |
1226 | |
1207 | /* ------------------------------------------------------------------------- */ |
1227 | /* ------------------------------------------------------------------------- */ |
1208 | /* |
1228 | /* |
1209 | * Erase part of whole of the screen |
1229 | * Erase part of whole of the screen |
… | |
… | |
1264 | CLEAR_ROWS (row, num); |
1284 | CLEAR_ROWS (row, num); |
1265 | } |
1285 | } |
1266 | else |
1286 | else |
1267 | { |
1287 | { |
1268 | ren = rstyle & (RS_fgMask | RS_bgMask); |
1288 | ren = rstyle & (RS_fgMask | RS_bgMask); |
1269 | gcvalue.foreground = pix_colors[GET_BGCOLOR (rstyle)]; |
1289 | gcvalue.foreground = pix_colors[bgcolor_of (rstyle)]; |
1270 | XChangeGC (display->display, gc, GCForeground, &gcvalue); |
1290 | XChangeGC (display->display, gc, GCForeground, &gcvalue); |
1271 | ERASE_ROWS (row, num); |
1291 | ERASE_ROWS (row, num); |
1272 | gcvalue.foreground = pix_colors[Color_fg]; |
1292 | gcvalue.foreground = pix_colors[Color_fg]; |
1273 | XChangeGC (display->display, gc, GCForeground, &gcvalue); |
1293 | XChangeGC (display->display, gc, GCForeground, &gcvalue); |
1274 | } |
1294 | } |
1275 | |
1295 | |
1276 | for (; num--; row++) |
1296 | for (; num--; row++) |
1277 | { |
1297 | { |
|
|
1298 | ROW (row).l = 0; |
1278 | scr_blank_screen_mem (ROW (row), rstyle); |
1299 | scr_blank_screen_mem (ROW (row), rstyle); |
1279 | ROW (row).l = 0; |
|
|
1280 | scr_blank_line (drawn_buf [row], 0, ncol, ren); |
1300 | scr_blank_line (drawn_buf [row], 0, ncol, ren); |
1281 | } |
1301 | } |
1282 | } |
1302 | } |
1283 | |
1303 | |
1284 | #if ENABLE_FRILLS |
1304 | #if ENABLE_FRILLS |
… | |
… | |
1573 | ::swap (pix_colors[Color_fg], pix_colors[Color_bg]); |
1593 | ::swap (pix_colors[Color_fg], pix_colors[Color_bg]); |
1574 | #if XPM_BACKGROUND |
1594 | #if XPM_BACKGROUND |
1575 | if (bgPixmap.pixmap == None) |
1595 | if (bgPixmap.pixmap == None) |
1576 | #endif |
1596 | #endif |
1577 | #if TRANSPARENT |
1597 | #if TRANSPARENT |
1578 | if (! (options & Opt_transparent) || am_transparent == 0) |
1598 | if (! OPTION (Opt_transparent) || am_transparent == 0) |
1579 | #endif |
1599 | #endif |
1580 | XSetWindowBackground (display->display, vt, |
1600 | XSetWindowBackground (display->display, vt, |
1581 | pix_colors[Color_bg]); |
1601 | pix_colors[Color_bg]); |
1582 | |
1602 | |
1583 | gcvalue.foreground = pix_colors[Color_fg]; |
1603 | gcvalue.foreground = pix_colors[Color_fg]; |
… | |
… | |
1816 | { |
1836 | { |
1817 | #ifndef NO_BELL |
1837 | #ifndef NO_BELL |
1818 | |
1838 | |
1819 | # ifndef NO_MAPALERT |
1839 | # ifndef NO_MAPALERT |
1820 | # ifdef MAPALERT_OPTION |
1840 | # ifdef MAPALERT_OPTION |
1821 | if (options & Opt_mapAlert) |
1841 | if (OPTION (Opt_mapAlert)) |
1822 | # endif |
1842 | # endif |
1823 | XMapWindow (display->display, parent[0]); |
1843 | XMapWindow (display->display, parent[0]); |
1824 | # endif |
1844 | # endif |
1825 | |
1845 | |
1826 | if (options & Opt_visualBell) |
1846 | if (OPTION (Opt_visualBell)) |
1827 | { |
1847 | { |
1828 | scr_rvideo_mode (!rvideo); /* refresh also done */ |
1848 | scr_rvideo_mode (!rvideo); /* refresh also done */ |
1829 | rxvt_usleep (VISUAL_BELL_DURATION); |
1849 | rxvt_usleep (VISUAL_BELL_DURATION); |
1830 | scr_rvideo_mode (!rvideo); /* refresh also done */ |
1850 | scr_rvideo_mode (!rvideo); /* refresh also done */ |
1831 | } |
1851 | } |
… | |
… | |
1922 | |
1942 | |
1923 | #if XPM_BACKGROUND |
1943 | #if XPM_BACKGROUND |
1924 | must_clear |= bgPixmap.pixmap != None; |
1944 | must_clear |= bgPixmap.pixmap != None; |
1925 | #endif |
1945 | #endif |
1926 | #if TRANSPARENT |
1946 | #if TRANSPARENT |
1927 | must_clear |= (options & Opt_transparent) && am_transparent; |
1947 | must_clear |= OPTION (Opt_transparent) && am_transparent; |
1928 | #endif |
1948 | #endif |
1929 | ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ |
1949 | ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ |
1930 | |
1950 | |
1931 | /* |
1951 | /* |
1932 | * B: reverse any characters which are selected |
1952 | * B: reverse any characters which are selected |
… | |
… | |
1956 | |
1976 | |
1957 | crp = &ROW(screen.cur.row).r[col]; |
1977 | crp = &ROW(screen.cur.row).r[col]; |
1958 | |
1978 | |
1959 | if (showcursor && focus) |
1979 | if (showcursor && focus) |
1960 | { |
1980 | { |
1961 | if (options & Opt_cursorUnderline) |
1981 | if (OPTION (Opt_cursorUnderline)) |
1962 | *crp ^= RS_Uline; |
1982 | *crp ^= RS_Uline; |
1963 | else |
1983 | else |
1964 | { |
1984 | { |
1965 | *crp ^= RS_RVid; |
1985 | *crp ^= RS_RVid; |
1966 | |
1986 | |
… | |
… | |
1968 | cc1 = *crp & (RS_fgMask | RS_bgMask); |
1988 | cc1 = *crp & (RS_fgMask | RS_bgMask); |
1969 | if (ISSET_PIXCOLOR (Color_cursor)) |
1989 | if (ISSET_PIXCOLOR (Color_cursor)) |
1970 | ccol1 = Color_cursor; |
1990 | ccol1 = Color_cursor; |
1971 | else |
1991 | else |
1972 | #ifdef CURSOR_COLOR_IS_RENDITION_COLOR |
1992 | #ifdef CURSOR_COLOR_IS_RENDITION_COLOR |
1973 | ccol1 = GET_FGCOLOR (rstyle); |
1993 | ccol1 = fgcolor_of (rstyle); |
1974 | #else |
1994 | #else |
1975 | ccol1 = Color_fg; |
1995 | ccol1 = Color_fg; |
1976 | #endif |
1996 | #endif |
1977 | if (ISSET_PIXCOLOR (Color_cursor2)) |
1997 | if (ISSET_PIXCOLOR (Color_cursor2)) |
1978 | ccol2 = Color_cursor2; |
1998 | ccol2 = Color_cursor2; |
1979 | else |
1999 | else |
1980 | #ifdef CURSOR_COLOR_IS_RENDITION_COLOR |
2000 | #ifdef CURSOR_COLOR_IS_RENDITION_COLOR |
1981 | ccol2 = GET_BGCOLOR (rstyle); |
2001 | ccol2 = bgcolor_of (rstyle); |
1982 | #else |
2002 | #else |
1983 | ccol2 = Color_bg; |
2003 | ccol2 = Color_bg; |
1984 | #endif |
2004 | #endif |
1985 | *crp = SET_FGCOLOR (*crp, ccol1); |
2005 | *crp = SET_FGCOLOR (*crp, ccol1); |
1986 | *crp = SET_BGCOLOR (*crp, ccol2); |
2006 | *crp = SET_BGCOLOR (*crp, ccol2); |
… | |
… | |
2167 | count++, i--; |
2187 | count++, i--; |
2168 | |
2188 | |
2169 | /* |
2189 | /* |
2170 | * Determine the attributes for the string |
2190 | * Determine the attributes for the string |
2171 | */ |
2191 | */ |
2172 | int fore = GET_FGCOLOR (rend); // desired foreground |
2192 | int fore = fgcolor_of (rend); // desired foreground |
2173 | int back = GET_BGCOLOR (rend); // desired background |
2193 | int back = bgcolor_of (rend); // desired background |
2174 | |
2194 | |
2175 | // 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 |
2176 | 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)) |
2177 | { |
2197 | { |
2178 | #if ENABLE_STYLES |
2198 | #if ENABLE_STYLES |
2179 | // force redraw after "careful" characters to avoid pixel droppings |
2199 | // force redraw after "careful" characters to avoid pixel droppings |
2180 | if (srp[col] & RS_Careful && col < ncol - 1 && 0) |
2200 | if (srp[col] & RS_Careful && col < ncol - 1 && 0) |
… | |
… | |
2299 | */ |
2319 | */ |
2300 | if (showcursor) |
2320 | if (showcursor) |
2301 | { |
2321 | { |
2302 | if (focus) |
2322 | if (focus) |
2303 | { |
2323 | { |
2304 | if (options & Opt_cursorUnderline) |
2324 | if (OPTION (Opt_cursorUnderline)) |
2305 | *crp ^= RS_Uline; |
2325 | *crp ^= RS_Uline; |
2306 | else |
2326 | else |
2307 | { |
2327 | { |
2308 | *crp ^= RS_RVid; |
2328 | *crp ^= RS_RVid; |
2309 | #ifndef NO_CURSORCOLOR |
2329 | #ifndef NO_CURSORCOLOR |
… | |
… | |
2428 | |
2448 | |
2429 | #if ENABLE_FRILLS |
2449 | #if ENABLE_FRILLS |
2430 | if (selection.rect) |
2450 | if (selection.rect) |
2431 | { |
2451 | { |
2432 | 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 | |
2433 | 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++) |
2434 | 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 | |
|
|
2463 | if (++col < selection.end.col) |
|
|
2464 | srp[col] ^= RS_RVid | RS_Uline; |
|
|
2465 | } |
2435 | } |
2466 | } |
2436 | else |
2467 | else |
2437 | #endif |
2468 | #endif |
2438 | { |
2469 | { |
2439 | if (selection.beg.row >= -view_start) |
2470 | if (selection.beg.row >= -view_start) |
… | |
… | |
2442 | row = selection.beg.row; |
2473 | row = selection.beg.row; |
2443 | } |
2474 | } |
2444 | else |
2475 | else |
2445 | { |
2476 | { |
2446 | col = 0; |
2477 | col = 0; |
2447 | row = view_start; |
2478 | row = -view_start; |
2448 | } |
2479 | } |
2449 | |
2480 | |
2450 | for (; row < min (selection.end.row, view_end); row++, col = 0) |
2481 | for (; row < min (selection.end.row, view_end); row++, col = 0) |
2451 | for (rend_t *srp = ROW(row).r; col < ncol; col++) |
2482 | for (rend_t *srp = ROW(row).r; col < ncol; col++) |
2452 | srp[col] ^= RS_RVid; |
2483 | srp[col] ^= RS_RVid; |
… | |
… | |
2866 | #endif |
2897 | #endif |
2867 | end_col = ROW(row).is_longer () ? ncol : ROW(row).l; //TODO//FIXME//LEN |
2898 | end_col = ROW(row).is_longer () ? ncol : ROW(row).l; //TODO//FIXME//LEN |
2868 | |
2899 | |
2869 | col = max (col, 0); |
2900 | col = max (col, 0); |
2870 | |
2901 | |
2871 | if (row == selection.end.row || selection.rect) |
2902 | if (row == selection.end.row |
|
|
2903 | #if ENABLE_FRILLS |
|
|
2904 | || selection.rect |
|
|
2905 | #endif |
|
|
2906 | ) |
2872 | end_col = min (end_col, selection.end.col); |
2907 | min_it (end_col, selection.end.col); |
2873 | |
2908 | |
2874 | t = ROW(row).t + col; |
2909 | t = ROW(row).t + col; |
2875 | for (; col < end_col; col++) |
2910 | for (; col < end_col; col++) |
2876 | { |
2911 | { |
2877 | if (*t == NOCHAR) |
2912 | if (*t == NOCHAR) |
… | |
… | |
2895 | #endif |
2930 | #endif |
2896 | else |
2931 | else |
2897 | new_selection_text[ofs++] = *t++; |
2932 | new_selection_text[ofs++] = *t++; |
2898 | } |
2933 | } |
2899 | |
2934 | |
|
|
2935 | #if ENABLE_FRILLS |
|
|
2936 | if (selection.rect) |
|
|
2937 | { |
|
|
2938 | while (ofs |
|
|
2939 | && new_selection_text[ofs - 1] != C0_LF |
|
|
2940 | && unicode::is_space (new_selection_text[ofs - 1])) |
|
|
2941 | --ofs; |
|
|
2942 | |
|
|
2943 | new_selection_text[ofs++] = C0_LF; |
|
|
2944 | } |
|
|
2945 | else |
|
|
2946 | #endif |
2900 | if (!ROW(row).is_longer () && row != selection.end.row) |
2947 | if (!ROW(row).is_longer () && row != selection.end.row) |
2901 | new_selection_text[ofs++] = C0_LF; |
2948 | new_selection_text[ofs++] = C0_LF; |
2902 | } |
2949 | } |
2903 | |
2950 | |
2904 | if (end_col != selection.end.col) |
2951 | if (end_col != selection.end.col) |
2905 | new_selection_text[ofs++] = C0_LF; |
2952 | new_selection_text[ofs++] = C0_LF; |
2906 | |
2953 | |
… | |
… | |
3257 | selection_delimit_word (DN, &selection.end, &selection.end); |
3304 | selection_delimit_word (DN, &selection.end, &selection.end); |
3258 | } |
3305 | } |
3259 | else if (selection.clicks == 3) |
3306 | else if (selection.clicks == 3) |
3260 | { |
3307 | { |
3261 | #if ENABLE_FRILLS |
3308 | #if ENABLE_FRILLS |
3262 | if (options & Opt_tripleclickwords) |
3309 | if (OPTION (Opt_tripleclickwords)) |
3263 | { |
3310 | { |
3264 | selection_delimit_word (UP, &selection.beg, &selection.beg); |
3311 | selection_delimit_word (UP, &selection.beg, &selection.beg); |
3265 | |
3312 | |
3266 | for (int end_row = selection.mark.row; end_row < nrow; end_row++) |
3313 | for (int end_row = selection.mark.row; end_row < nrow; end_row++) |
3267 | { |
3314 | { |
… | |
… | |
3328 | { |
3375 | { |
3329 | stp = ROW(end_row).t; |
3376 | stp = ROW(end_row).t; |
3330 | |
3377 | |
3331 | while (--end_col >= 0) |
3378 | while (--end_col >= 0) |
3332 | { |
3379 | { |
3333 | if (stp[end_col] != ' ' |
3380 | if (stp[end_col] != NOCHAR |
3334 | && stp[end_col] != '\t' |
3381 | && !unicode::is_space (stp[end_col])) |
3335 | && stp[end_col] != NOCHAR) |
|
|
3336 | break; |
3382 | break; |
3337 | } |
3383 | } |
3338 | |
3384 | |
3339 | if (end_col >= 0 |
3385 | if (end_col >= 0 |
3340 | || !ROW(end_row - 1).is_longer ()) |
3386 | || !ROW(end_row - 1).is_longer ()) |
… | |
… | |
3656 | for (int y = ov_h; y--; ) |
3702 | for (int y = ov_h; y--; ) |
3657 | { |
3703 | { |
3658 | text_t *t1 = ov_text[y]; |
3704 | text_t *t1 = ov_text[y]; |
3659 | rend_t *r1 = ov_rend[y]; |
3705 | rend_t *r1 = ov_rend[y]; |
3660 | |
3706 | |
3661 | text_t *t2 = ROW(y - view_start).t + ov_x; |
3707 | text_t *t2 = ROW(y + ov_y - view_start).t + ov_x; |
3662 | rend_t *r2 = ROW(y - view_start).r + ov_x; |
3708 | rend_t *r2 = ROW(y + ov_y - view_start).r + ov_x; |
3663 | |
3709 | |
3664 | for (int x = ov_w; x--; ) |
3710 | for (int x = ov_w; x--; ) |
3665 | { |
3711 | { |
3666 | text_t t = *t1; *t1++ = *t2; *t2++ = t; |
3712 | text_t t = *t1; *t1++ = *t2; *t2++ = t; |
3667 | rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, FONTSET (r)->find_font (t)); |
3713 | rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, FONTSET (r)->find_font (t)); |