… | |
… | |
189 | } |
189 | } |
190 | |
190 | |
191 | if (prev_nrow == 0) |
191 | if (prev_nrow == 0) |
192 | { |
192 | { |
193 | /* |
193 | /* |
194 | * first time called so just malloc everything : don't rely on realloc |
194 | * first time called so just malloc everything: don't rely on realloc |
195 | * Note: this is still needed so that all the scrollback lines are NULL |
195 | * Note: this is still needed so that all the scrollback lines are NULL |
196 | */ |
196 | */ |
197 | screen.text = (text_t **)rxvt_calloc (total_rows, sizeof (text_t *)); |
197 | screen.text = (text_t **)rxvt_calloc (total_rows, sizeof (text_t *)); |
198 | buf_text = (text_t **)rxvt_calloc (total_rows, sizeof (text_t *)); |
198 | buf_text = (text_t **)rxvt_calloc (total_rows, sizeof (text_t *)); |
199 | drawn_text = (text_t **)rxvt_calloc (nrow, sizeof (text_t *)); |
199 | drawn_text = (text_t **)rxvt_calloc (nrow, sizeof (text_t *)); |
… | |
… | |
256 | scr_scroll_text (0, (int)prev_nrow - 1, k, 1); |
256 | scr_scroll_text (0, (int)prev_nrow - 1, k, 1); |
257 | |
257 | |
258 | for (p = nrow; p < prev_nrow; p++) |
258 | for (p = nrow; p < prev_nrow; p++) |
259 | { |
259 | { |
260 | q = p + TermWin.saveLines; |
260 | q = p + TermWin.saveLines; |
|
|
261 | |
261 | if (screen.text[q]) |
262 | if (screen.text[q]) |
262 | { |
263 | { |
263 | #ifdef DEBUG_STRICT |
264 | #ifdef DEBUG_STRICT |
264 | assert (screen.rend[q]); |
265 | assert (screen.rend[q]); |
265 | #endif |
266 | #endif |
266 | talloc->free (screen.text[q]); |
267 | talloc->free (screen.text[q]); |
267 | ralloc->free (screen.rend[q]); |
268 | ralloc->free (screen.rend[q]); |
268 | } |
269 | } |
|
|
270 | |
269 | if (swap.text[p]) |
271 | if (swap.text[p]) |
270 | { |
272 | { |
271 | #ifdef DEBUG_STRICT |
273 | #ifdef DEBUG_STRICT |
272 | assert (swap.rend[p]); |
274 | assert (swap.rend[p]); |
273 | #endif |
275 | #endif |
274 | talloc->free (swap.text[p]); |
276 | talloc->free (swap.text[p]); |
275 | ralloc->free (swap.rend[p]); |
277 | ralloc->free (swap.rend[p]); |
276 | } |
278 | } |
|
|
279 | |
277 | #ifdef DEBUG_STRICT |
280 | #ifdef DEBUG_STRICT |
278 | assert (drawn_text[p] && drawn_rend[p]); |
281 | assert (drawn_text[p] && drawn_rend[p]); |
279 | #endif |
282 | #endif |
280 | talloc->free (drawn_text[p]); |
283 | talloc->free (drawn_text[p]); |
281 | ralloc->free (drawn_rend[p]); |
284 | ralloc->free (drawn_rend[p]); |
… | |
… | |
311 | swap.tlen[p] = 0; |
314 | swap.tlen[p] = 0; |
312 | swap.text[p] = NULL; |
315 | swap.text[p] = NULL; |
313 | swap.rend[p] = NULL; |
316 | swap.rend[p] = NULL; |
314 | drawn_text[p] = NULL; |
317 | drawn_text[p] = NULL; |
315 | drawn_rend[p] = NULL; |
318 | drawn_rend[p] = NULL; |
316 | scr_blank_screen_mem (swap.text, swap.rend, p, setrstyle); |
319 | scr_blank_screen_mem (swap.text, swap.rend, p, setrstyle); |
317 | scr_blank_screen_mem (drawn_text, drawn_rend, p, setrstyle); |
320 | scr_blank_screen_mem (drawn_text, drawn_rend, p, setrstyle); |
318 | } |
321 | } |
319 | |
322 | |
320 | if (k > 0) |
323 | if (k > 0) |
321 | { |
324 | { |
… | |
… | |
336 | } |
339 | } |
337 | |
340 | |
338 | /* resize columns */ |
341 | /* resize columns */ |
339 | if (ncol != prev_ncol) |
342 | if (ncol != prev_ncol) |
340 | { |
343 | { |
341 | int common = min (prev_ncol, ncol); |
|
|
342 | rxvt_salloc *ta = new rxvt_salloc (ncol * sizeof (text_t)); |
344 | rxvt_salloc *ta = new rxvt_salloc (ncol * sizeof (text_t)); |
343 | rxvt_salloc *ra = new rxvt_salloc (ncol * sizeof (rend_t)); |
345 | rxvt_salloc *ra = new rxvt_salloc (ncol * sizeof (rend_t)); |
344 | |
346 | |
345 | for (p = 0; p < total_rows; p++) |
347 | for (p = 0; p < total_rows; p++) |
346 | { |
348 | { |
347 | if (screen.text[p]) |
349 | if (screen.text[p]) |
348 | { |
350 | { |
349 | text_t *t = (text_t *)ta->alloc (); memcpy (t, screen.text[p], common * sizeof (text_t)); screen.text[p] = t; |
351 | screen.text[p] = (text_t *)ta->alloc (screen.text[p], prev_ncol * sizeof (text_t)); |
350 | rend_t *r = (rend_t *)ra->alloc (); memcpy (r, screen.rend[p], common * sizeof (rend_t)); screen.rend[p] = r; |
352 | screen.rend[p] = (rend_t *)ra->alloc (screen.rend[p], prev_ncol * sizeof (rend_t)); |
351 | |
353 | |
352 | MIN_IT (screen.tlen[p], (int16_t)ncol); |
354 | MIN_IT (screen.tlen[p], (int16_t)ncol); |
353 | |
355 | |
354 | if (ncol > prev_ncol) |
356 | if (ncol > prev_ncol) |
355 | scr_blank_line (& (screen.text[p][prev_ncol]), |
357 | scr_blank_line (&screen.text[p][prev_ncol], |
356 | & (screen.rend[p][prev_ncol]), |
358 | &screen.rend[p][prev_ncol], |
357 | ncol - prev_ncol, |
359 | ncol - prev_ncol, setrstyle); |
358 | setrstyle); |
|
|
359 | } |
360 | } |
360 | } |
361 | } |
361 | |
362 | |
362 | for (p = 0; p < nrow; p++) |
363 | for (p = 0; p < nrow; p++) |
363 | { |
364 | { |
364 | text_t *t = (text_t *)ta->alloc (); memcpy (t, drawn_text[p], common * sizeof (text_t)); drawn_text[p] = t; |
365 | drawn_text[p] = (text_t *)ta->alloc (drawn_text[p], prev_ncol * sizeof (text_t)); |
365 | rend_t *r = (rend_t *)ra->alloc (); memcpy (r, drawn_rend[p], common * sizeof (rend_t)); drawn_rend[p] = r; |
366 | drawn_rend[p] = (rend_t *)ra->alloc (drawn_rend[p], prev_ncol * sizeof (rend_t)); |
366 | |
367 | |
367 | if (ncol > prev_ncol) |
368 | if (ncol > prev_ncol) |
368 | scr_blank_line (& (drawn_text[p][prev_ncol]), |
369 | scr_blank_line (&drawn_text[p][prev_ncol], |
369 | & (drawn_rend[p][prev_ncol]), |
370 | &drawn_rend[p][prev_ncol], |
370 | ncol - prev_ncol, setrstyle); |
371 | ncol - prev_ncol, setrstyle); |
371 | |
372 | |
372 | if (swap.text[p]) |
373 | if (swap.text[p]) |
373 | { |
374 | { |
374 | text_t *t = (text_t *)ta->alloc (); memcpy (t, swap.text[p], common * sizeof (text_t)); swap.text[p] = t; |
375 | swap.text[p] = (text_t *)ta->alloc (swap.text[p], prev_ncol * sizeof (text_t)); |
375 | rend_t *r = (rend_t *)ra->alloc (); memcpy (r, swap.rend[p], common * sizeof (rend_t)); swap.rend[p] = r; |
376 | swap.rend[p] = (rend_t *)ra->alloc (swap.rend[p], prev_ncol * sizeof (rend_t)); |
376 | |
377 | |
377 | MIN_IT (swap.tlen[p], (int16_t)ncol); |
378 | MIN_IT (swap.tlen[p], (int16_t)ncol); |
378 | |
379 | |
379 | if (ncol > prev_ncol) |
380 | if (ncol > prev_ncol) |
380 | scr_blank_line (& (swap.text[p][prev_ncol]), |
381 | scr_blank_line (&swap.text[p][prev_ncol], |
381 | & (swap.rend[p][prev_ncol]), |
382 | &swap.rend[p][prev_ncol], |
382 | ncol - prev_ncol, setrstyle); |
383 | ncol - prev_ncol, setrstyle); |
383 | } |
384 | } |
384 | |
385 | |
385 | } |
386 | } |
386 | |
387 | |
… | |
… | |
476 | |
477 | |
477 | scr_release (); |
478 | scr_release (); |
478 | prev_nrow = prev_ncol = 0; |
479 | prev_nrow = prev_ncol = 0; |
479 | scr_reset (); |
480 | scr_reset (); |
480 | |
481 | |
481 | scr_clear (); |
482 | scr_clear (true); |
482 | scr_refresh (SLOW_REFRESH); |
483 | scr_refresh (SLOW_REFRESH); |
483 | } |
484 | } |
484 | |
485 | |
485 | /* ------------------------------------------------------------------------- * |
486 | /* ------------------------------------------------------------------------- * |
486 | * PROCESS SCREEN COMMANDS * |
487 | * PROCESS SCREEN COMMANDS * |
… | |
… | |
709 | for (i = 0, j = row1; i < count; i++, j++) |
710 | for (i = 0, j = row1; i < count; i++, j++) |
710 | { |
711 | { |
711 | buf_text[i] = screen.text[j]; |
712 | buf_text[i] = screen.text[j]; |
712 | buf_rend[i] = screen.rend[j]; |
713 | buf_rend[i] = screen.rend[j]; |
713 | } |
714 | } |
|
|
715 | |
714 | /* A2: Rotate lines */ |
716 | /* A2: Rotate lines */ |
715 | for (j = row1, i = j + count; i <= row2; i++, j++) |
717 | for (j = row1, i = j + count; i <= row2; i++, j++) |
716 | { |
718 | { |
717 | screen.tlen[j] = screen.tlen[i]; |
719 | screen.tlen[j] = screen.tlen[i]; |
718 | screen.text[j] = screen.text[i]; |
720 | screen.text[j] = screen.text[i]; |
719 | screen.rend[j] = screen.rend[i]; |
721 | screen.rend[j] = screen.rend[i]; |
720 | } |
722 | } |
|
|
723 | |
721 | j = row2 - count + 1, i = count; |
724 | j = row2 - count + 1, i = count; |
722 | } |
725 | } |
723 | else /* if (j < 0) */ |
726 | else /* if (j < 0) */ |
724 | { |
727 | { |
725 | /* B: scroll down */ |
728 | /* B: scroll down */ |
… | |
… | |
728 | for (i = 0, j = row2; i < count; i++, j--) |
731 | for (i = 0, j = row2; i < count; i++, j--) |
729 | { |
732 | { |
730 | buf_text[i] = screen.text[j]; |
733 | buf_text[i] = screen.text[j]; |
731 | buf_rend[i] = screen.rend[j]; |
734 | buf_rend[i] = screen.rend[j]; |
732 | } |
735 | } |
|
|
736 | |
733 | /* B2: Rotate lines */ |
737 | /* B2: Rotate lines */ |
734 | for (j = row2, i = j - count; i >= row1; i--, j--) |
738 | for (j = row2, i = j - count; i >= row1; i--, j--) |
735 | { |
739 | { |
736 | screen.tlen[j] = screen.tlen[i]; |
740 | screen.tlen[j] = screen.tlen[i]; |
737 | screen.text[j] = screen.text[i]; |
741 | screen.text[j] = screen.text[i]; |
738 | screen.rend[j] = screen.rend[i]; |
742 | screen.rend[j] = screen.rend[i]; |
739 | } |
743 | } |
|
|
744 | |
740 | j = row1, i = count; |
745 | j = row1, i = count; |
741 | count = -count; |
746 | count = -count; |
742 | } |
747 | } |
743 | |
748 | |
744 | /* C: Resurrect lines */ |
749 | /* C: Resurrect lines */ |
… | |
… | |
747 | screen.tlen[j] = 0; |
752 | screen.tlen[j] = 0; |
748 | screen.text[j] = buf_text[i]; |
753 | screen.text[j] = buf_text[i]; |
749 | screen.rend[j] = buf_rend[i]; |
754 | screen.rend[j] = buf_rend[i]; |
750 | |
755 | |
751 | if (!spec) /* line length may not equal TermWin.ncol */ |
756 | if (!spec) /* line length may not equal TermWin.ncol */ |
752 | scr_blank_screen_mem (screen.text, screen.rend, |
757 | scr_blank_screen_mem (screen.text, screen.rend, (unsigned int)j, rstyle); |
753 | (unsigned int)j, rstyle); |
|
|
754 | } |
758 | } |
755 | |
759 | |
756 | return count; |
760 | return count; |
757 | } |
761 | } |
758 | |
762 | |
… | |
… | |
886 | c = vt100_0[c - 0x5f]; |
890 | c = vt100_0[c - 0x5f]; |
887 | width = 1; |
891 | width = 1; |
888 | } |
892 | } |
889 | } |
893 | } |
890 | |
894 | |
891 | if (width > 0) |
895 | if (width != 0) |
892 | { |
896 | { |
893 | #if !UNICODE_3 && ENABLE_COMBINING |
897 | #if !UNICODE_3 && ENABLE_COMBINING |
894 | // trim characters we can't store directly :( |
898 | // trim characters we can't store directly :( |
895 | if (c >= 0x10000) |
899 | if (c >= 0x10000) |
896 | c = rxvt_composite.compose (c); // map to lower 16 bits |
900 | c = rxvt_composite.compose (c); // map to lower 16 bits |
… | |
… | |
1236 | default: |
1240 | default: |
1237 | return; |
1241 | return; |
1238 | } |
1242 | } |
1239 | |
1243 | |
1240 | if (screen.text[row]) |
1244 | if (screen.text[row]) |
1241 | scr_blank_line (& (screen.text[row][col]), |
1245 | scr_blank_line (&screen.text[row][col], &screen.rend[row][col], num, rstyle); |
1242 | & (screen.rend[row][col]), num, rstyle); |
|
|
1243 | else |
1246 | else |
1244 | scr_blank_screen_mem (screen.text, screen.rend, row, rstyle); |
1247 | scr_blank_screen_mem (screen.text, screen.rend, row, rstyle); |
1245 | } |
1248 | } |
1246 | |
1249 | |
1247 | /* ------------------------------------------------------------------------- */ |
1250 | /* ------------------------------------------------------------------------- */ |
… | |
… | |
1767 | } |
1770 | } |
1768 | |
1771 | |
1769 | D_SCREEN ((stderr, "rxvt_scr_expose (x:%d, y:%d, w:%d, h:%d) area (c:%d,r:%d)- (c:%d,r:%d)", x, y, width, height, rc[PART_BEG].col, rc[PART_BEG].row, rc[PART_END].col, rc[PART_END].row)); |
1772 | D_SCREEN ((stderr, "rxvt_scr_expose (x:%d, y:%d, w:%d, h:%d) area (c:%d,r:%d)- (c:%d,r:%d)", x, y, width, height, rc[PART_BEG].col, rc[PART_BEG].row, rc[PART_END].col, rc[PART_END].row)); |
1770 | |
1773 | |
1771 | for (i = rc[PART_BEG].row; i <= rc[PART_END].row; i++) |
1774 | for (i = rc[PART_BEG].row; i <= rc[PART_END].row; i++) |
1772 | fill_text (& (drawn_text[i][rc[PART_BEG].col]), 0, |
1775 | fill_text (&drawn_text[i][rc[PART_BEG].col], 0, rc[PART_END].col - rc[PART_BEG].col + 1); |
1773 | (rc[PART_END].col - rc[PART_BEG].col + 1)); |
|
|
1774 | |
1776 | |
1775 | if (refresh) |
1777 | if (refresh) |
1776 | scr_refresh (SLOW_REFRESH | REFRESH_BOUNDS); |
1778 | scr_refresh (SLOW_REFRESH | REFRESH_BOUNDS); |
1777 | } |
1779 | } |
1778 | |
1780 | |
… | |
… | |
2613 | |
2615 | |
2614 | nread += ct.nitems; |
2616 | nread += ct.nitems; |
2615 | |
2617 | |
2616 | char **cl; |
2618 | char **cl; |
2617 | int cr; |
2619 | int cr; |
2618 | if (XmbTextPropertyToTextList (display->display, &ct, &cl, |
2620 | if (XmbTextPropertyToTextList (display->display, &ct, &cl, &cr) >= 0 && cl) |
2619 | &cr) >= 0 && cl) |
|
|
2620 | { |
2621 | { |
2621 | for (int i = 0; i < cr; i++) |
2622 | for (int i = 0; i < cr; i++) |
2622 | paste ((unsigned char *)cl[i], STRLEN (cl[i])); |
2623 | paste ((unsigned char *)cl[i], STRLEN (cl[i])); |
2623 | |
2624 | |
2624 | XFreeStringList (cl); |
2625 | XFreeStringList (cl); |
… | |
… | |
3519 | pos->y = Height2Pixel ((screen.cur.row + 1)) + xwa.y - TermWin.lineSpace; |
3520 | pos->y = Height2Pixel ((screen.cur.row + 1)) + xwa.y - TermWin.lineSpace; |
3520 | } |
3521 | } |
3521 | |
3522 | |
3522 | #endif |
3523 | #endif |
3523 | /* ------------------------------------------------------------------------- */ |
3524 | /* ------------------------------------------------------------------------- */ |
3524 | |
|
|
3525 | /* ------------------------------------------------------------------------- * |
|
|
3526 | * DEBUG ROUTINES * |
|
|
3527 | * ------------------------------------------------------------------------- */ |
|
|
3528 | #if 0 |
|
|
3529 | void |
|
|
3530 | rxvt_debug_colors (void) |
|
|
3531 | { |
|
|
3532 | int color; |
|
|
3533 | const char *name[] = |
|
|
3534 | { |
|
|
3535 | "fg", "bg", |
|
|
3536 | "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white" |
|
|
3537 | }; |
|
|
3538 | |
|
|
3539 | fprintf (stderr, "Color ( "); |
|
|
3540 | if (rstyle & RS_RVid) |
|
|
3541 | fprintf (stderr, "rvid "); |
|
|
3542 | if (rstyle & RS_Bold) |
|
|
3543 | fprintf (stderr, "bold "); |
|
|
3544 | if (rstyle & RS_Blink) |
|
|
3545 | fprintf (stderr, "blink "); |
|
|
3546 | if (rstyle & RS_Uline) |
|
|
3547 | fprintf (stderr, "uline "); |
|
|
3548 | fprintf (stderr, "): "); |
|
|
3549 | |
|
|
3550 | color = GET_FGCOLOR (rstyle); |
|
|
3551 | #ifndef NO_BRIGHTCOLOR |
|
|
3552 | if (color >= minBrightCOLOR && color <= maxBrightCOLOR) |
|
|
3553 | { |
|
|
3554 | color -= (minBrightCOLOR - minCOLOR); |
|
|
3555 | fprintf (stderr, "bright "); |
|
|
3556 | } |
|
|
3557 | #endif |
|
|
3558 | fprintf (stderr, "%s on ", name[color]); |
|
|
3559 | |
|
|
3560 | color = GET_BGCOLOR (rstyle); |
|
|
3561 | #ifndef NO_BRIGHTCOLOR |
|
|
3562 | if (color >= minBrightCOLOR && color <= maxBrightCOLOR) |
|
|
3563 | { |
|
|
3564 | color -= (minBrightCOLOR - minCOLOR); |
|
|
3565 | fprintf (stderr, "bright "); |
|
|
3566 | } |
|
|
3567 | #endif |
|
|
3568 | fprintf (stderr, "%s\n", name[color]); |
|
|
3569 | } |
|
|
3570 | #endif |
|
|