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.461 by root, Thu Jun 17 00:49:20 2021 UTC vs.
Revision 1.465 by root, Thu Aug 4 18:28:44 2022 UTC

107 } 107 }
108 108
109 l.touch (); 109 l.touch ();
110 110
111 efs &= ~RS_baseattrMask; // remove italic etc. fontstyles 111 efs &= ~RS_baseattrMask; // remove italic etc. fontstyles
112 efs = SET_FONT (efs, FONTSET (efs)->find_font (' ')); 112 efs = SET_FONT (efs, FONTSET (efs)->find_space_font ());
113 113
114 text_t *et = l.t + col; 114 text_t *et = l.t + col;
115 rend_t *er = l.r + col; 115 rend_t *er = l.r + col;
116 116
117 while (width--) 117 while (width--)
139 // find begin 139 // find begin
140 while (col > 0 && l.t[col] == NOCHAR) 140 while (col > 0 && l.t[col] == NOCHAR)
141 col--; 141 col--;
142 142
143 rend_t rend = l.r[col] & ~RS_baseattrMask; 143 rend_t rend = l.r[col] & ~RS_baseattrMask;
144 rend = SET_FONT (rend, FONTSET (rend)->find_font (' ')); 144 rend = SET_FONT (rend, FONTSET (rend)->find_space_font ());
145 145
146 l.touch (); 146 l.touch ();
147 147
148 // found start, nuke 148 // found start, nuke
149 do { 149 do {
291 * add or delete rows as appropriate 291 * add or delete rows as appropriate
292 */ 292 */
293 293
294 int common_col = min (prev_ncol, ncol); 294 int common_col = min (prev_ncol, ncol);
295 295
296 // resize swap_buf, blank drawn_buf
296 for (int row = min (nrow, prev_nrow); row--; ) 297 for (int row = min (nrow, prev_nrow); row--; )
297 { 298 {
298 scr_blank_screen_mem (drawn_buf [row], DEFAULT_RSTYLE); 299 scr_blank_screen_mem (drawn_buf [row], DEFAULT_RSTYLE);
299 memcpy (drawn_buf [row].t, prev_drawn_buf [row].t, sizeof (text_t) * common_col); 300 memcpy (drawn_buf [row].t, prev_drawn_buf [row].t, sizeof (text_t) * common_col);
300 memcpy (drawn_buf [row].r, prev_drawn_buf [row].r, sizeof (rend_t) * common_col); 301 memcpy (drawn_buf [row].r, prev_drawn_buf [row].r, sizeof (rend_t) * common_col);
304 305
305 int p = MOD (term_start + prev_nrow, prev_total_rows); // previous row 306 int p = MOD (term_start + prev_nrow, prev_total_rows); // previous row
306 int pend = MOD (term_start + top_row , prev_total_rows); 307 int pend = MOD (term_start + top_row , prev_total_rows);
307 int q = total_rows; // rewrapped row 308 int q = total_rows; // rewrapped row
308 309
309 if (top_row) 310#if ENABLE_FRILLS
311 if ((rewrap_always || top_row) && !rewrap_never)
310 { 312 {
311 // Re-wrap lines. This is rather ugly, possibly because I am too dumb 313 // Re-wrap lines. This is rather ugly, possibly because I am too dumb
312 // to come up with a lean and mean algorithm. 314 // to come up with a lean and mean algorithm.
313 // TODO: maybe optimise when width didn't change 315 // TODO: maybe optimise when width didn't change
314 316
330 llen += prev_ncol; 332 llen += prev_ncol;
331 } 333 }
332 334
333 int qlines = max (0, (llen - 1) / ncol) + 1; 335 int qlines = max (0, (llen - 1) / ncol) + 1;
334 336
337 q -= qlines;
338
335 // drop partial lines completely 339 // drop partial lines completely
336 if (q < qlines) 340 if (q < 0)
337 break; 341 break;
338
339 q -= qlines;
340 342
341 int lofs = 0; 343 int lofs = 0;
342 line_t *qline; 344 line_t *qline;
343 345
344 // re-assemble the full line by destination lines 346 // re-assemble the full line by destination lines
386 qline->is_longer (0); 388 qline->is_longer (0);
387 scr_blank_line (*qline, qline->l, ncol - qline->l, DEFAULT_RSTYLE); 389 scr_blank_line (*qline, qline->l, ncol - qline->l, DEFAULT_RSTYLE);
388 } 390 }
389 while (p != pend && q > 0); 391 while (p != pend && q > 0);
390 392
391 term_start = total_rows - nrow;
392 top_row = q - term_start;
393
394 // make sure all terminal lines exist 393 // make sure all terminal lines exist
395 while (top_row > 0) 394 while (top_row > 0)
396 scr_blank_screen_mem (ROW (--top_row), DEFAULT_RSTYLE); 395 scr_blank_screen_mem (ROW (--top_row), DEFAULT_RSTYLE);
397 } 396 }
398 else 397 else
398#endif
399 {
400 // wing, instead of wrap
399 { 401 do
400 // if no scrollback exists (yet), wing, instead of wrap
401
402 for (int row = min (nrow, prev_nrow); row--; )
403 { 402 {
404 line_t &src = prev_row_buf [MOD (term_start + row, prev_total_rows)]; 403 p = MOD (p - 1, prev_total_rows);
405 line_t &dst = row_buf [row]; 404 q--;
406 405
407 copy_line (dst, src); 406 copy_line (row_buf [q], prev_row_buf [p]);
408 } 407 }
408 while (p != pend);
409 409
410 for (int row = prev_nrow; row < nrow; row++) 410 screen.cur.row += nrow - prev_nrow;
411 scr_blank_screen_mem (row_buf [row], DEFAULT_RSTYLE);
412
413 term_start = 0;
414 } 411 }
412
413 term_start = total_rows - nrow;
414 top_row = q - term_start;
415 415
416 clamp_it (screen.cur.row, 0, nrow - 1); 416 clamp_it (screen.cur.row, 0, nrow - 1);
417 clamp_it (screen.cur.col, 0, ncol - 1); 417 clamp_it (screen.cur.col, 0, ncol - 1);
418 } 418 }
419 419
420 // ensure drawn_buf, swap_buf and terminal rows are all initialized
420 for (int row = nrow; row--; ) 421 for (int row = nrow; row--; )
421 { 422 {
422 if (!ROW (row).valid ()) scr_blank_screen_mem (ROW (row), DEFAULT_RSTYLE); 423 if (!ROW (row).valid ()) scr_blank_screen_mem (ROW (row), DEFAULT_RSTYLE);
423 if (!swap_buf [row].valid ()) scr_blank_screen_mem (swap_buf [row], DEFAULT_RSTYLE); 424 if (!swap_buf [row].valid ()) scr_blank_screen_mem (swap_buf [row], DEFAULT_RSTYLE);
424 if (!drawn_buf [row].valid ()) scr_blank_screen_mem (drawn_buf [row], DEFAULT_RSTYLE); 425 if (!drawn_buf [row].valid ()) scr_blank_screen_mem (drawn_buf [row], DEFAULT_RSTYLE);
2714 /* convert normal newline chars into common keyboard Return key sequence */ 2715 /* convert normal newline chars into common keyboard Return key sequence */
2715 for (unsigned int i = 0; i < len; i++) 2716 for (unsigned int i = 0; i < len; i++)
2716 if (data[i] == C0_LF) 2717 if (data[i] == C0_LF)
2717 data[i] = C0_CR; 2718 data[i] = C0_CR;
2718 2719
2719 if (priv_modes & PrivMode_BracketPaste) 2720 #if ENABLE_FRILLS
2721 if ((priv_modes & PrivMode_BracketPaste) && !option (Opt_disablePasteBrackets))
2720 tt_printf ("\x1b[200~"); 2722 tt_printf ("\x1b[200~");
2723 #endif
2721 2724
2722 tt_write (data, len); 2725 tt_write (data, len);
2723 2726
2724 if (priv_modes & PrivMode_BracketPaste) 2727 #if ENABLE_FRILLS
2728 if ((priv_modes & PrivMode_BracketPaste) && !option (Opt_disablePasteBrackets))
2725 tt_printf ("\x1b[201~"); 2729 tt_printf ("\x1b[201~");
2730 #endif
2726} 2731}
2727 2732
2728void 2733void
2729rxvt_term::paste (char *data, unsigned int len) noexcept 2734rxvt_term::paste (char *data, unsigned int len) noexcept
2730{ 2735{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines