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.195 by root, Mon Dec 26 23:02:34 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 */
150} 147}
151 148
152/* ------------------------------------------------------------------------- * 149/* ------------------------------------------------------------------------- *
153 * SCREEN INITIALISATION * 150 * SCREEN INITIALISATION *
154 * ------------------------------------------------------------------------- */ 151 * ------------------------------------------------------------------------- */
152
155void 153void
156rxvt_term::scr_reset () 154rxvt_term::scr_reset ()
157{ 155{
158 unsigned int p, q;
159 int k;
160
161#if ENABLE_OVERLAY 156#if ENABLE_OVERLAY
162 scr_overlay_off (); 157 scr_overlay_off ();
163#endif 158#endif
164 159
165 view_start = 0; 160 view_start = 0;
175 return; 170 return;
176 171
177 // we need at least two lines for wrapping to work correctly 172 // we need at least two lines for wrapping to work correctly
178 if (nrow + saveLines < 2) 173 if (nrow + saveLines < 2)
179 { 174 {
175 //TODO//FIXME
180 saveLines++; 176 saveLines++;
181 prev_nrow--; 177 prev_nrow--;
182 nsaved++; 178 nsaved++;
183 } 179 }
184 180
188 total_rows = nrow + saveLines; 184 total_rows = nrow + saveLines;
189 185
190 screen.tscroll = 0; 186 screen.tscroll = 0;
191 screen.bscroll = nrow - 1; 187 screen.bscroll = nrow - 1;
192 188
193 if (!save) 189 if (!row_buf)
194 { 190 {
195 /* 191 /*
196 * first time called so just malloc everything: don't rely on realloc 192 * first time called so just malloc everything: don't rely on realloc
197 * Note: this is still needed so that all the scrollback lines are NULL 193 * Note: this is still needed so that all the scrollback lines are NULL
198 */ 194 */
200 term_start = 0; 196 term_start = 0;
201 197
202 talloc = new rxvt_salloc (ncol * sizeof (text_t)); 198 talloc = new rxvt_salloc (ncol * sizeof (text_t));
203 ralloc = new rxvt_salloc (ncol * sizeof (rend_t)); 199 ralloc = new rxvt_salloc (ncol * sizeof (rend_t));
204 200
205 save = (line_t *)rxvt_calloc (total_rows, sizeof (line_t));
206 buf = (line_t *)rxvt_calloc (total_rows, sizeof (line_t)); 201 row_buf = (line_t *)rxvt_calloc (total_rows, sizeof (line_t));
202 temp_buf = (line_t *)rxvt_calloc (total_rows, sizeof (line_t));
207 drawn = (line_t *)rxvt_calloc (nrow, sizeof (line_t)); 203 drawn_buf = (line_t *)rxvt_calloc (nrow , sizeof (line_t));
208 swap_save = (line_t *)rxvt_calloc (nrow, sizeof (line_t)); 204 swap_buf = (line_t *)rxvt_calloc (nrow , sizeof (line_t));
209 205
210 for (p = nrow; p--; ) 206 for (int row = nrow; row--; )
211 { 207 {
212 scr_blank_screen_mem (ROW(p), DEFAULT_RSTYLE); 208 scr_blank_screen_mem (ROW (row), DEFAULT_RSTYLE);
213 scr_blank_screen_mem (swap_save[p], DEFAULT_RSTYLE); 209 scr_blank_screen_mem (swap_buf [row], DEFAULT_RSTYLE);
214 scr_blank_screen_mem (drawn[p], DEFAULT_RSTYLE); 210 scr_blank_screen_mem (drawn_buf[row], DEFAULT_RSTYLE);
215 } 211 }
216 212
217 memset (charsets, 'B', sizeof (charsets)); 213 memset (charsets, 'B', sizeof (charsets));
218 rstyle = DEFAULT_RSTYLE; 214 rstyle = DEFAULT_RSTYLE;
219 screen.flags = Screen_DefaultFlags; 215 screen.flags = Screen_DefaultFlags;
243 { 239 {
244 /* 240 /*
245 * add or delete rows as appropriate 241 * add or delete rows as appropriate
246 */ 242 */
247 243
248 rxvt_salloc *old_ta; 244 rxvt_salloc *old_ta = talloc; talloc = new rxvt_salloc (ncol * sizeof (text_t));
249 rxvt_salloc *old_ra; 245 rxvt_salloc *old_ra = ralloc; ralloc = new rxvt_salloc (ncol * sizeof (rend_t));
250 246
247#if 0
251 if (nrow < prev_nrow) 248 if (nrow < prev_nrow)
252 { 249 {
253 /* delete rows */
254 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
256 scr_scroll_text (0, (int)prev_nrow - 1, k, 1);
257
258 for (p = nrow; p < prev_nrow; p++) 250 for (int row = nrow; row < prev_nrow; row++)
259 { 251 {
260 lfree (ROW(p));
261 lfree (swap_save[p]); 252 lfree (swap_buf [row]);
262 lfree (drawn[p]); 253 lfree (drawn_buf[row]);
263 } 254 }
255 }
256#endif
264 257
265 /* we have fewer rows so fix up cursor position */ 258 drawn_buf = (line_t *)rxvt_realloc (drawn_buf, nrow * sizeof (line_t));
266 MIN_IT (screen.cur.row, (int32_t)nrow - 1); 259 temp_buf = (line_t *)rxvt_realloc (temp_buf , nrow * sizeof (line_t));
260 swap_buf = (line_t *)rxvt_realloc (swap_buf , nrow * sizeof (line_t));
267 261
268 scr_reset_realloc (); /* realloc _last_ */ 262 for (int row = min (nrow, prev_nrow); row--; )
263 {
264 lresize (drawn_buf[row]);
265 lresize (swap_buf [row]);
266 }
267
268 for (int row = prev_nrow; row < nrow; row++)
269 {
270 swap_buf [row].clear (); scr_blank_screen_mem (swap_buf [row], DEFAULT_RSTYLE);
271 drawn_buf[row].clear (); scr_blank_screen_mem (drawn_buf[row], DEFAULT_RSTYLE);
272 }
273
274 line_t *old_buf = row_buf; row_buf = (line_t *)rxvt_calloc (total_rows, sizeof (line_t));
269 } 275
270 else if (nrow > prev_nrow) 276 int p = MOD (term_start + prev_nrow, prev_total_rows); // previous row
277 int pend = MOD (term_start - nsaved , prev_total_rows);
278 int q = total_rows; // rewrapped row
279
280 if (nsaved)
281 {
282 // re-wrap lines, this is rather ugly, possibly because I am too dumb
283 // to come up with a lean and mean algorithm.
284
285 row_col_t ocur = screen.cur;
286 ocur.row = MOD (term_start + ocur.row, prev_total_rows);
287
271 { 288 do
272 /* add rows */
273 scr_reset_realloc (); /* realloc _first_ */
274
275 int ocol = ncol;
276 ncol = prev_ncol; // save b/c scr_blank_screen_mem uses this
277
278 k = min (nsaved, nrow - prev_nrow);
279
280 for (p = prev_total_rows; p < total_rows; p++)
281 save[p].clear ();
282
283 for (p = prev_total_rows; p < total_rows - k; p++)
284 scr_blank_screen_mem (save[p], DEFAULT_RSTYLE);
285
286 for (p = prev_nrow; p < nrow; p++)
287 { 289 {
288 swap_save[p].clear (); scr_blank_screen_mem (swap_save[p], DEFAULT_RSTYLE); 290 p = MOD (p - 1, prev_total_rows);
289 drawn[p].clear (); scr_blank_screen_mem (drawn[p], DEFAULT_RSTYLE);
290 }
291
292 if (k > 0)
293 {
294 scr_scroll_text (0, (int)nrow - 1, -k, 1);
295 screen.cur.row += k;
296 screen.s_cur.row += k;
297 nsaved -= k;
298 }
299
300#ifdef DEBUG_STRICT 291#ifdef DEBUG_STRICT
301 assert (screen.cur.row < nrow); 292 assert (old_buf [MOD (p, prev_total_rows)].t);
302#else /* drive with your eyes closed */
303 MIN_IT (screen.cur.row, nrow - 1);
304#endif 293#endif
305 ncol = ocol; // save b/c scr_blank_screen_mem uses this
306 }
307 294
308 /* resize columns */
309 if (ncol != prev_ncol)
310 {
311 old_ta = talloc; talloc = new rxvt_salloc (ncol * sizeof (text_t));
312 old_ra = ralloc; ralloc = new rxvt_salloc (ncol * sizeof (rend_t));
313
314 for (p = total_rows; p--; )
315 lresize (save[p]);
316
317 for (p = nrow; p--; )
318 {
319 lresize (drawn[p]);
320 lresize (swap_save[p]);
321 }
322
323 MIN_IT (screen.cur.col, (int16_t)ncol - 1);
324
325 delete old_ta;
326 delete old_ra;
327 }
328
329#if 0
330 // re-wrap lines, this is rather ugly, possibly because I am too dumb
331 // to come up with a lean and mean algorithm.
332 rxvt_salloc *ta = new rxvt_salloc (ncol * sizeof (text_t));
333 rxvt_salloc *ra = new rxvt_salloc (ncol * sizeof (rend_t));
334
335 text_t **tp = (text_t **)rxvt_calloc (total_rows, sizeof (text_t *));
336 rend_t **rp = (rend_t **)rxvt_calloc (total_rows, sizeof (rend_t *));
337 tlen_t *tl = (tlen_t *) rxvt_calloc (total_rows, sizeof (tlen_t));
338
339 for (p = 0; p < prev_total_rows; p++) printf ("P %p %d\n", save[p].t, save[p].l);//D
340
341 p = prev_total_rows;
342 q = total_rows;
343
344 while (p > 0 && q > 0)
345 {
346 --p;
347
348 printf ("pq %d:%d\n", p, q);
349 if (save[p].t)
350 {
351 int llen = save[p].l; 295 int plines = 1;
296 int llen = old_buf [MOD (p, prev_total_rows)].l;
352 297
353 assert (llen >= 0); 298 while (p != pend && old_buf [MOD (p - 1, prev_total_rows)].is_longer ())
354
355 while (p && save[p - 1].l < 0)
356 { 299 {
300 p = MOD (p - 1, prev_total_rows);
301
357 --p; 302 plines++;
358 llen += prev_ncol; 303 llen += prev_ncol;
359 } 304 }
360 305
361 int qlines = llen / ncol + 1; 306 int qlines = max (0, (llen - 1) / ncol) + 1;
307
308 // drop partial lines completely
309 if (q < qlines)
310 break;
311
312 q -= qlines;
313
362 int lofs = 0; 314 int lofs = 0;
315 line_t *qline;
363 316
364 q -= qlines; 317 // re-assemble the full line by destination lines
365
366 int qrow = q;
367
368 printf ("QL %d llen %d\n", qlines, llen);//D
369 for (; qlines--; qrow++) 318 for (int qrow = q; qlines--; qrow++)
370 { 319 {
320 qline = row_buf + qrow;
321 lalloc (*qline);
322 qline->set_is_longer ();
323
371 if (qrow >= 0) 324 int qcol = 0;
325
326 // fill a single destination line
327 while (lofs < llen && qcol < ncol)
372 { 328 {
373 tp [qrow] = (text_t *)ta->alloc ();
374 rp [qrow] = (rend_t *)ra->alloc ();
375 tl [qrow] = LINE_CONT1;
376
377 int qcol = 0;
378
379 for (;;)
380 {
381 int prow = lofs / prev_ncol + p; 329 int prow = lofs / prev_ncol;
382 int pcol = lofs % prev_ncol; 330 int pcol = lofs % prev_ncol;
383 331
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];
342
384 int len = min (min (prev_ncol - pcol, ncol - qcol), llen - lofs); 343 int len = min (min (prev_ncol - pcol, ncol - qcol), llen - lofs);
385 344
386 printf ("q %d lofs %d>%d len %d pq %d:%d p %d:%d q :%d\n", q, llen, lofs, len, prev_ncol, ncol, prow, pcol, qcol);
387
388 if (len <= 0)
389 {
390 tl [qrow] = qcol;
391
392 TODO
393 scr_blank_line (tp [qrow] + qcol, rp [qrow] + qcol,
394 ncol - qcol, DEFAULT_RSTYLE);
395
396 break;
397 }
398
399 assert (lofs < 1000); 345 assert (len);
346 assert (pline.t);
400 347
401 memcpy (tp [qrow] + qcol, save[prow].t + pcol, len * sizeof (text_t)); 348 memcpy (qline->t + qcol, pline.t + pcol, len * sizeof (text_t));
402 memcpy (rp [qrow] + qcol, save[prow].r + pcol, len * sizeof (rend_t)); 349 memcpy (qline->r + qcol, pline.r + pcol, len * sizeof (rend_t));
403 350
404 lofs += len; 351 lofs += len;
405 qcol += len; 352 qcol += len;
406
407 if (qcol == ncol)
408 break;
409 }
410 } 353 }
411 else
412 lofs += ncol;
413 } 354 }
355
356 qline->l = llen < ncol ? llen : MOD (llen - 1, ncol) + 1;
357 printf ("qline->l %d = llen %d < ncol %d ? %d : MOD %d\n", qline->l,llen,ncol,llen,MOD (llen - 1, ncol) + 1);//D
358 scr_blank_line (*qline, qline->l, ncol - qline->l, DEFAULT_RSTYLE);
414 } 359 }
360 while (p != pend && q > 0);
361
362 term_start = total_rows - nrow;
363 nsaved = term_start - q;
364
365 // make sure all terminal lines exist
366 while (nsaved < 0)
367 scr_blank_screen_mem (ROW (-++nsaved), DEFAULT_RSTYLE);
368
369 }
370 else
415 } 371 {
372 // if no scrollback exists (yet), wing, instead of wrap
373
374 for (int row = min (nrow, prev_nrow); row--; )
375 {
376 line_t &pline = old_buf [MOD (term_start + row, prev_total_rows)];
377 line_t &qline = row_buf [row];
416 378
417 free (screen.text); screen.text = tp; 379 qline = pline;
418 free (screen.rend); screen.rend = rp; 380 lresize (qline);
419 free (screen.tlen); screen.tlen = tl; 381 }
420 382
421 for (p = 0; p < total_rows; p++) printf ("P %p %d\n", save[p].t, save[p].l);//D 383 for (int row = prev_nrow; row < nrow; row++)
384 {
385 row_buf [row].clear (); scr_blank_screen_mem (row_buf [row], DEFAULT_RSTYLE);
386 }
387
388 term_start = 0;
389 }
390
391#ifdef DEBUG_STRICT //TODO: remove
392 for (int i = -nsaved; i < nrow; i++)
393 assert (ROW (i).t);
422#endif 394#endif
395
396 free (old_buf);
397 delete old_ta;
398 delete old_ra;
399
400 clamp_it (screen.cur.row, 0, nrow - 1);
401 clamp_it (screen.cur.col, 0, ncol - 1);
423 402
424 if (tabs) 403 if (tabs)
425 free (tabs); 404 free (tabs);
426 } 405 }
427 406
428 prev_nrow = nrow; 407 prev_nrow = nrow;
429 prev_ncol = ncol; 408 prev_ncol = ncol;
430 409
431 tabs = (char *)rxvt_malloc (ncol * sizeof (char)); 410 tabs = (char *)rxvt_malloc (ncol * sizeof (char));
432 411
433 for (p = 0; p < ncol; p++) 412 for (int col = ncol; col--; )
434 tabs[p] = (p % TABSIZE == 0) ? 1 : 0; 413 tabs [col] = col % TABSIZE == 0;
435 414
436 tt_winch (); 415 tt_winch ();
437}
438
439void
440rxvt_term::scr_reset_realloc ()
441{
442 swap_save = (line_t *) rxvt_realloc (swap_save , nrow * sizeof (line_t));
443 drawn = (line_t *) rxvt_realloc (drawn , nrow * sizeof (line_t));
444 buf = (line_t *) rxvt_realloc (buf , nrow * sizeof (line_t));
445 save = (line_t *) rxvt_realloc (save , total_rows * sizeof (line_t));
446} 416}
447 417
448/* ------------------------------------------------------------------------- */ 418/* ------------------------------------------------------------------------- */
449/* 419/*
450 * Free everything. That way malloc debugging can find leakage. 420 * Free everything. That way malloc debugging can find leakage.
453rxvt_term::scr_release () 423rxvt_term::scr_release ()
454{ 424{
455 delete talloc; talloc = 0; 425 delete talloc; talloc = 0;
456 delete ralloc; ralloc = 0; 426 delete ralloc; ralloc = 0;
457 427
458 free (save); 428 free (row_buf);
459 free (swap_save); 429 free (swap_buf);
460 free (drawn); 430 free (drawn_buf);
461 free (buf); 431 free (temp_buf);
462 free (tabs); 432 free (tabs);
433
434 row_buf = 0; // signal that we freed all the arrays
463} 435}
464 436
465/* ------------------------------------------------------------------------- */ 437/* ------------------------------------------------------------------------- */
466/* 438/*
467 * Hard reset 439 * Hard reset
518 set_font_style (); 490 set_font_style ();
519 break; 491 break;
520 } 492 }
521 493
522 /* boundary check in case screen size changed between SAVE and RESTORE */ 494 /* boundary check in case screen size changed between SAVE and RESTORE */
523 MIN_IT (s->cur.row, nrow - 1); 495 min_it (s->cur.row, nrow - 1);
524 MIN_IT (s->cur.col, ncol - 1); 496 min_it (s->cur.col, ncol - 1);
525#ifdef DEBUG_STRICT 497#ifdef DEBUG_STRICT
526 assert (s->cur.row >= 0); 498 assert (s->cur.row >= 0);
527 assert (s->cur.col >= 0); 499 assert (s->cur.col >= 0);
528#else /* drive with your eyes closed */
529 MAX_IT (s->cur.row, 0);
530 MAX_IT (s->cur.col, 0);
531#endif 500#endif
532} 501}
533 502
534/* ------------------------------------------------------------------------- */ 503/* ------------------------------------------------------------------------- */
535/* 504/*
538 * XTERM_SEQ: Secondary screen: ESC [ ? 4 7 l 507 * XTERM_SEQ: Secondary screen: ESC [ ? 4 7 l
539 */ 508 */
540int 509int
541rxvt_term::scr_change_screen (int scrn) 510rxvt_term::scr_change_screen (int scrn)
542{ 511{
543 int i;
544#if NSCREENS
545 int offset;
546#endif
547
548 want_refresh = 1; 512 want_refresh = 1;
549
550 view_start = 0; 513 view_start = 0;
551 514
552 if (current_screen == scrn) 515 if (current_screen == scrn)
553 return scrn; 516 return scrn;
554 517
555 selection_check (2); /* check for boundary cross */ 518 selection_check (2); /* check for boundary cross */
556 519
557 i = current_screen; current_screen = scrn; scrn = i; 520 int i = current_screen; current_screen = scrn; scrn = i;
558 521
559 SWAP_IT (screen.cur.row, swap.cur.row, int16_t); 522 ::swap (screen.cur.row, swap.cur.row);
560 SWAP_IT (screen.cur.col, swap.cur.col, int16_t); 523 ::swap (screen.cur.col, swap.cur.col);
561 MAX_IT (screen.cur.row, 0); 524
562 MIN_IT (screen.cur.row, (int32_t)prev_nrow - 1); 525 screen.cur.row = clamp (screen.cur.row, 0, prev_nrow - 1);
563 MAX_IT (screen.cur.col, 0); 526 screen.cur.col = clamp (screen.cur.col, 0, prev_ncol - 1);
564 MIN_IT (screen.cur.col, (int32_t)prev_ncol - 1);
565 527
566#if NSCREENS 528#if NSCREENS
567 if (options & Opt_secondaryScreen) 529 if (options & Opt_secondaryScreen)
568 { 530 {
569 num_scr = 0; 531 num_scr = 0;
570 offset = saveLines;
571 532
572 for (i = prev_nrow; i--;) 533 for (int i = prev_nrow; i--; )
573 SWAP_IT (ROW(i), swap_save[i], line_t); 534 ::swap (ROW(i), swap_buf [i]);
574 535
575 SWAP_IT (screen.charset, swap.charset, int16_t); 536 ::swap (screen.charset, swap.charset);
576 SWAP_IT (screen.flags, swap.flags, int); 537 ::swap (screen.flags, swap.flags);
577 screen.flags |= Screen_VisibleCursor; 538 screen.flags |= Screen_VisibleCursor;
578 swap.flags |= Screen_VisibleCursor; 539 swap.flags |= Screen_VisibleCursor;
579 } 540 }
580 else 541 else
581#endif 542#endif
582 if (options & Opt_secondaryScroll) 543 if (options & Opt_secondaryScroll)
583 scr_scroll_text (0, prev_nrow - 1, prev_nrow, 0); 544 scr_scroll_text (0, prev_nrow - 1, prev_nrow);
584 545
585 return scrn; 546 return scrn;
586} 547}
587 548
588// clear WrapNext indicator, solidifying position on next line 549// clear WrapNext indicator, solidifying position on next line
595 screen.flags &= ~Screen_WrapNext; 556 screen.flags &= ~Screen_WrapNext;
596 557
597 screen.cur.col = 0; 558 screen.cur.col = 0;
598 559
599 if (screen.cur.row == screen.bscroll) 560 if (screen.cur.row == screen.bscroll)
600 scr_scroll_text (screen.tscroll, screen.bscroll, 1, 0); 561 scr_scroll_text (screen.tscroll, screen.bscroll, 1);
601 else if (screen.cur.row < nrow - 1) 562 else if (screen.cur.row < nrow - 1)
602 screen.cur.row++; 563 screen.cur.row++;
603} 564}
604 565
605/* ------------------------------------------------------------------------- */ 566/* ------------------------------------------------------------------------- */
636/* ------------------------------------------------------------------------- */ 597/* ------------------------------------------------------------------------- */
637/* 598/*
638 * Scroll text between <row1> and <row2> inclusive, by <count> lines 599 * Scroll text between <row1> and <row2> inclusive, by <count> lines
639 * count positive ==> scroll up 600 * count positive ==> scroll up
640 * count negative ==> scroll down 601 * count negative ==> scroll down
641 * spec == 0 for normal routines
642 */ 602 */
643int 603int
644rxvt_term::scr_scroll_text (int row1, int row2, int count, int spec) 604rxvt_term::scr_scroll_text (int row1, int row2, int count)
645{ 605{
646 int i, j;
647
648 if (count == 0 || (row1 > row2)) 606 if (count == 0 || (row1 > row2))
649 return 0; 607 return 0;
650 608
651 want_refresh = 1; 609 want_refresh = 1;
610 num_scr += count;
652 611
653 if (row1 == 0 && count > 0 612 if (count > 0
613 && row1 == 0
614 && row2 == nrow - 1
654 && (current_screen == PRIMARY || options & Opt_secondaryScroll)) 615 && (current_screen == PRIMARY || options & Opt_secondaryScroll))
655 { 616 {
656 nsaved = min (nsaved + count, saveLines); 617 nsaved = min (nsaved + count, saveLines);
657 term_start = (term_start + count) % total_rows; 618 term_start = (term_start + count) % total_rows;
658 619
659 if (selection.op && current_screen == selection.screen) 620 if (selection.op && current_screen == selection.screen)
660 { 621 {
661 selection.beg.row -= count; 622 selection.beg.row -= count;
662 selection.end.row -= count; 623 selection.end.row -= count;
663 selection.mark.row -= count; 624 selection.mark.row -= count;
625
626 if (selection.beg.row < -nsaved
627 || selection.end.row < -nsaved
628 || selection.mark.row < -nsaved)
629 {
630 CLEAR_ALL_SELECTION ();
631 selection.op = SELECTION_CLEAR;
632 }
664 } 633 }
665 634
666 for (int i = count; i--; ) 635 for (int i = count; i--; )
636 {
637 ROW(row2 - i).l = 0;
667 scr_blank_screen_mem (ROW(row2 - i), rstyle); 638 scr_blank_screen_mem (ROW(row2 - i), rstyle);
639 }
668 640
669 if ((options & Opt_scrollWithBuffer) 641 if ((options & Opt_scrollWithBuffer)
670 && view_start != 0 642 && view_start != 0
671 && view_start != saveLines) 643 && view_start != saveLines)
672 scr_page (UP, count); 644 scr_page (UP, count);
673 } 645 }
674 else 646 else
675 { 647 {
676 if (!spec)
677 row1 += saveLines;
678
679 row2 += saveLines;
680
681 if (selection.op && current_screen == selection.screen) 648 if (selection.op && current_screen == selection.screen)
682 { 649 {
683 i = selection.beg.row + saveLines; 650 if ((selection.beg.row < row1 && selection.end.row > row1)
684 j = selection.end.row + saveLines; 651 || (selection.beg.row < row2 && selection.end.row > row2)
685
686 if ((i < row1 && j > row1)
687 || (i < row2 && j > row2)
688 || (i - count < row1 && i >= row1) 652 || (selection.beg.row - count < row1 && selection.beg.row >= row1)
689 || (i - count > row2 && i <= row2) 653 || (selection.beg.row - count > row2 && selection.beg.row <= row2)
690 || (j - count < row1 && j >= row1) 654 || (selection.end.row - count < row1 && selection.end.row >= row1)
691 || (j - count > row2 && j <= row2)) 655 || (selection.end.row - count > row2 && selection.end.row <= row2))
692 { 656 {
693 CLEAR_ALL_SELECTION (); 657 CLEAR_ALL_SELECTION ();
694 selection.op = SELECTION_CLEAR; /* XXX: too aggressive? */ 658 selection.op = SELECTION_CLEAR;
695 } 659 }
696 else if (j >= row1 && j <= row2) 660 else if (selection.end.row >= row1 && selection.end.row <= row2)
697 { 661 {
698 /* move selected region too */ 662 /* move selected region too */
699 selection.beg.row -= count; 663 selection.beg.row -= count;
700 selection.end.row -= count; 664 selection.end.row -= count;
701 selection.mark.row -= count; 665 selection.mark.row -= count;
666
667 selection_check (0);
702 } 668 }
703 } 669 }
704 670
705 selection_check (0); /* _after_ nsaved update */ 671 // use a simple and robust scrolling algorithm, this
672 // part of scr_scroll_text is not time-critical.
706 673
707 num_scr += count;
708 j = count;
709
710 if (count < 0)
711 count = -count;
712
713 i = row2 - row1 + 1; 674 int rows = row2 - row1 + 1;
714 MIN_IT (count, i);
715 675
716 if (j > 0) 676 min_it (count, rows);
717 {
718 /* scroll up */
719 677
720 /* Copy lines that will get clobbered by the rotation */ 678 for (int row = 0; row < rows; row++)
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 } 679 {
729 else /* if (j < 0) */ 680 temp_buf [row] = ROW(row1 + (row + count + rows) % rows);
681
682 if (!IN_RANGE_EXC (row + count, 0, rows))
683 scr_blank_screen_mem (temp_buf [row], rstyle);
730 { 684 }
731 /* scroll down */
732 685
733 /* Copy lines that will get clobbered by the rotation */ 686 for (int row = 0; row < rows; row++)
734 for (i = 0, j = row2; i < count; i++, j--) 687 ROW(row1 + row) = temp_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 } 688 }
752 689
753 return count; 690 return count;
754} 691}
755 692
763 if (len <= 0) /* sanity */ 700 if (len <= 0) /* sanity */
764 return; 701 return;
765 702
766 unsigned char checksel; 703 unsigned char checksel;
767 unicode_t c; 704 unicode_t c;
768 int row, last_col; 705 int last_col;
769 const unicode_t *strend = str + len; 706 const unicode_t *strend = str + len;
770 707
771 want_refresh = 1; 708 want_refresh = 1;
772 ZERO_SCROLLBACK (); 709 ZERO_SCROLLBACK ();
773 last_col = ncol; 710 last_col = ncol;
774 711
775 if (nlines > 0) 712 if (nlines > 0)
776 { 713 {
777 nlines += screen.cur.row - screen.bscroll; 714 nlines += screen.cur.row - screen.bscroll;
778 if ((nlines > 0) 715 if (nlines > 0
779 && (screen.tscroll == 0) 716 && screen.tscroll == 0
780 && (screen.bscroll == (nrow - 1))) 717 && screen.bscroll == (nrow - 1))
781 { 718 {
782 /* _at least_ this many lines need to be scrolled */ 719 /* _at least_ this many lines need to be scrolled */
783 scr_scroll_text (screen.tscroll, screen.bscroll, nlines, 0); 720 scr_scroll_text (screen.tscroll, screen.bscroll, nlines);
784 screen.cur.row -= nlines; 721 screen.cur.row -= nlines;
785 } 722 }
786 } 723 }
787 724
788#ifdef DEBUG_STRICT 725#ifdef DEBUG_STRICT
789 assert (screen.cur.col < last_col); 726 assert (screen.cur.col < last_col);
790 assert ((screen.cur.row < nrow) 727 assert (screen.cur.row < nrow
791 && (screen.cur.row >= - (int32_t)nsaved)); 728 && screen.cur.row >= -nsaved);
792#else /* drive with your eyes closed */
793 MIN_IT (screen.cur.col, last_col - 1);
794 MIN_IT (screen.cur.row, (int32_t)nrow - 1);
795 MAX_IT (screen.cur.row, - (int32_t)nsaved);
796#endif 729#endif
797 row = screen.cur.row; 730 int row = screen.cur.row;
798 731
799 checksel = selection.op && current_screen == selection.screen ? 1 : 0; 732 checksel = selection.op && current_screen == selection.screen ? 1 : 0;
800 733
801 line_t *line = &ROW(row); 734 line_t *line = &ROW(row);
802 735
804 { 737 {
805 c = *str++; 738 c = *str++;
806 739
807 if (c < 0x20) 740 if (c < 0x20)
808 if (c == C0_LF) 741 if (c == C0_LF)
809 { 742 {
810 if (!line->is_longer ()) /* XXX: think about this */ 743 if (!line->is_longer ()) /* XXX: think about this */
811 MAX_IT (line->l, screen.cur.col); 744 max_it (line->l, screen.cur.col);
812 745
813 screen.flags &= ~Screen_WrapNext; 746 screen.flags &= ~Screen_WrapNext;
814 747
815 if (screen.cur.row == screen.bscroll) 748 if (screen.cur.row == screen.bscroll)
816 scr_scroll_text (screen.tscroll, screen.bscroll, 1, 0); 749 scr_scroll_text (screen.tscroll, screen.bscroll, 1);
817 else if (screen.cur.row < (nrow - 1)) 750 else if (screen.cur.row < (nrow - 1))
818 row = ++screen.cur.row; 751 row = ++screen.cur.row;
819 752
820 line = &ROW(row); /* _must_ refresh */ 753 line = &ROW(row); /* _must_ refresh */
821 continue; 754 continue;
822 } 755 }
823 else if (c == C0_CR) 756 else if (c == C0_CR)
824 { 757 {
825 if (!line->is_longer ()) /* XXX: think about this */ 758 if (!line->is_longer ()) /* XXX: think about this */
826 MAX_IT (line->l, screen.cur.col); 759 max_it (line->l, screen.cur.col);
827 760
828 screen.flags &= ~Screen_WrapNext; 761 screen.flags &= ~Screen_WrapNext;
829 screen.cur.col = 0; 762 screen.cur.col = 0;
830 continue; 763 continue;
831 } 764 }
1007#endif 940#endif
1008 } 941 }
1009 } 942 }
1010 943
1011 if (!line->is_longer ()) /* XXX: think about this */ 944 if (!line->is_longer ()) /* XXX: think about this */
1012 MAX_IT (line->l, screen.cur.col); 945 max_it (line->l, screen.cur.col);
1013 946
1014#ifdef DEBUG_STRICT 947#ifdef DEBUG_STRICT
1015 assert (screen.cur.row >= 0); 948 assert (screen.cur.row >= 0);
1016#else /* drive with your eyes closed */
1017 MAX_IT (screen.cur.row, 0);
1018#endif 949#endif
1019} 950}
1020 951
1021/* ------------------------------------------------------------------------- */ 952/* ------------------------------------------------------------------------- */
1022/* 953/*
1061 992
1062 if (count == 0) 993 if (count == 0)
1063 return; 994 return;
1064 else if (count > 0) 995 else if (count > 0)
1065 { 996 {
1066 int row = screen.cur.row;
1067
1068 line_t &l = ROW(row); 997 line_t &l = ROW(screen.cur.row);
1069 rend_t base_rend = l.r[i]; 998 rend_t base_rend = l.r[i];
1070 ht &= l.t[i] == ' '; 999 ht &= l.t[i] == ' ';
1071 1000
1072 for (; ++i < ncol; ) 1001 for (; ++i < ncol; )
1073 if (tabs[i]) 1002 if (tabs[i])
1088 if (ht && options & Opt_pastableTabs) 1017 if (ht && options & Opt_pastableTabs)
1089 { 1018 {
1090 base_rend = SET_FONT (base_rend, 0); 1019 base_rend = SET_FONT (base_rend, 0);
1091 1020
1092 if (!l.is_longer ()) /* XXX: think about this */ 1021 if (!l.is_longer ()) /* XXX: think about this */
1093 MAX_IT (l.l, x); 1022 max_it (l.l, x);
1094 1023
1095 i = screen.cur.col; 1024 i = screen.cur.col;
1096 1025
1097 l.t[i] = '\t'; 1026 l.t[i] = '\t';
1098 l.r[i] = base_rend; 1027 l.r[i] = base_rend;
1148 */ 1077 */
1149#if ENABLE_FRILLS 1078#if ENABLE_FRILLS
1150void 1079void
1151rxvt_term::scr_forwardindex () 1080rxvt_term::scr_forwardindex ()
1152{ 1081{
1153 int row;
1154
1155 if (screen.cur.col < ncol - 1) 1082 if (screen.cur.col < ncol - 1)
1156 scr_gotorc (0, 1, R_RELATIVE | C_RELATIVE); 1083 scr_gotorc (0, 1, R_RELATIVE | C_RELATIVE);
1157 else 1084 else
1158 { 1085 {
1159 row = screen.cur.row;
1160
1161 if (ROW(row).is_longer ()) //TODO//FIXME//LEN 1086 if (ROW(screen.cur.row).is_longer ()) //TODO//FIXME//LEN
1162 ROW(row).l = ncol; 1087 ROW(screen.cur.row).l = ncol;
1163 1088
1164 scr_gotorc (0, 0, R_RELATIVE); 1089 scr_gotorc (0, 0, R_RELATIVE);
1165 scr_insdel_chars (1, DELETE); 1090 scr_insdel_chars (1, DELETE);
1166 scr_gotorc (0, ncol - 1, R_RELATIVE); 1091 scr_gotorc (0, ncol - 1, R_RELATIVE);
1167 } 1092 }
1177{ 1102{
1178 want_refresh = 1; 1103 want_refresh = 1;
1179 ZERO_SCROLLBACK (); 1104 ZERO_SCROLLBACK ();
1180 1105
1181 screen.cur.col = relative & C_RELATIVE ? screen.cur.col + col : col; 1106 screen.cur.col = relative & C_RELATIVE ? screen.cur.col + col : col;
1182 MAX_IT (screen.cur.col, 0); 1107 clamp_it (screen.cur.col, 0, ncol - 1);
1183 MIN_IT (screen.cur.col, (int32_t)ncol - 1);
1184 1108
1185 screen.flags &= ~Screen_WrapNext; 1109 screen.flags &= ~Screen_WrapNext;
1186 1110
1187 if (relative & R_RELATIVE) 1111 if (relative & R_RELATIVE)
1188 { 1112 {
1206 else 1130 else
1207 { 1131 {
1208 if (screen.flags & Screen_Relative) 1132 if (screen.flags & Screen_Relative)
1209 { /* relative origin mode */ 1133 { /* relative origin mode */
1210 screen.cur.row = row + screen.tscroll; 1134 screen.cur.row = row + screen.tscroll;
1211 MIN_IT (screen.cur.row, screen.bscroll); 1135 min_it (screen.cur.row, screen.bscroll);
1212 } 1136 }
1213 else 1137 else
1214 screen.cur.row = row; 1138 screen.cur.row = row;
1215 } 1139 }
1216 1140
1217 MAX_IT (screen.cur.row, 0); 1141 clamp_it (screen.cur.row, 0, nrow - 1);
1218 MIN_IT (screen.cur.row, (int32_t)nrow - 1);
1219} 1142}
1220 1143
1221/* ------------------------------------------------------------------------- */ 1144/* ------------------------------------------------------------------------- */
1222/* 1145/*
1223 * direction should be UP or DN 1146 * direction should be UP or DN
1234 1157
1235 screen.flags &= ~Screen_WrapNext; 1158 screen.flags &= ~Screen_WrapNext;
1236 1159
1237 if ((screen.cur.row == screen.bscroll && direction == UP) 1160 if ((screen.cur.row == screen.bscroll && direction == UP)
1238 || (screen.cur.row == screen.tscroll && direction == DN)) 1161 || (screen.cur.row == screen.tscroll && direction == DN))
1239 scr_scroll_text (screen.tscroll, screen.bscroll, dirn, 0); 1162 scr_scroll_text (screen.tscroll, screen.bscroll, dirn);
1240 else 1163 else
1241 screen.cur.row += dirn; 1164 screen.cur.row += dirn;
1242 1165
1243 MAX_IT (screen.cur.row, 0); 1166 clamp_it (screen.cur.row, 0, nrow - 1);
1244 MIN_IT (screen.cur.row, (int32_t)nrow - 1);
1245 selection_check (0); 1167 selection_check (0);
1246} 1168}
1247 1169
1248/* ------------------------------------------------------------------------- */ 1170/* ------------------------------------------------------------------------- */
1249/* 1171/*
1253 * XTERM_SEQ: Clear whole line : ESC [ 2 K 1175 * XTERM_SEQ: Clear whole line : ESC [ 2 K
1254 */ 1176 */
1255void 1177void
1256rxvt_term::scr_erase_line (int mode) 1178rxvt_term::scr_erase_line (int mode)
1257{ 1179{
1258 unsigned int row, col, num; 1180 unsigned int col, num;
1259 1181
1260 want_refresh = 1; 1182 want_refresh = 1;
1261 ZERO_SCROLLBACK (); 1183 ZERO_SCROLLBACK ();
1262 1184
1263 selection_check (1); 1185 selection_check (1);
1264 1186
1265 row = screen.cur.row; 1187 line_t &line = ROW(screen.cur.row);
1266 1188
1267 switch (mode) 1189 switch (mode)
1268 { 1190 {
1269 case 0: /* erase to end of line */ 1191 case 0: /* erase to end of line */
1270 col = screen.cur.col; 1192 col = screen.cur.col;
1271 num = ncol - col; 1193 num = ncol - col;
1272 MIN_IT (ROW(row).l, (int16_t)col); 1194 min_it (line.l, col);
1273 if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur) 1195 if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)
1274 || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur)) 1196 || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur))
1275 CLEAR_SELECTION (); 1197 CLEAR_SELECTION ();
1276 break; 1198 break;
1277 case 1: /* erase to beginning of line */ 1199 case 1: /* erase to beginning of line */
1282 CLEAR_SELECTION (); 1204 CLEAR_SELECTION ();
1283 break; 1205 break;
1284 case 2: /* erase whole line */ 1206 case 2: /* erase whole line */
1285 col = 0; 1207 col = 0;
1286 num = ncol; 1208 num = ncol;
1287 ROW(row).l = 0; 1209 line.l = 0;
1288 if (selection.beg.row <= screen.cur.row 1210 if (selection.beg.row <= screen.cur.row
1289 && selection.end.row >= screen.cur.row) 1211 && selection.end.row >= screen.cur.row)
1290 CLEAR_SELECTION (); 1212 CLEAR_SELECTION ();
1291 break; 1213 break;
1292 default: 1214 default:
1293 return; 1215 return;
1294 } 1216 }
1295 1217
1296 scr_blank_line (ROW(row), col, num, rstyle); 1218 scr_blank_line (line, col, num, rstyle);
1297} 1219}
1298 1220
1299/* ------------------------------------------------------------------------- */ 1221/* ------------------------------------------------------------------------- */
1300/* 1222/*
1301 * Erase part of whole of the screen 1223 * Erase part of whole of the screen
1305 */ 1227 */
1306void 1228void
1307rxvt_term::scr_erase_screen (int mode) 1229rxvt_term::scr_erase_screen (int mode)
1308{ 1230{
1309 int num; 1231 int num;
1310 int32_t row, row_offset; 1232 int32_t row;
1311 rend_t ren; 1233 rend_t ren;
1312 XGCValues gcvalue; 1234 XGCValues gcvalue;
1313 1235
1314 want_refresh = 1; 1236 want_refresh = 1;
1315 ZERO_SCROLLBACK (); 1237 ZERO_SCROLLBACK ();
1316
1317 row_offset = (int32_t)saveLines;
1318 1238
1319 switch (mode) 1239 switch (mode)
1320 { 1240 {
1321 case 0: /* erase to end of screen */ 1241 case 0: /* erase to end of screen */
1322 selection_check (1); 1242 selection_check (1);
1346 CLEAR_SELECTION (); 1266 CLEAR_SELECTION ();
1347 1267
1348 if (row >= nrow) /* Out Of Bounds */ 1268 if (row >= nrow) /* Out Of Bounds */
1349 return; 1269 return;
1350 1270
1351 MIN_IT (num, (nrow - row)); 1271 min_it (num, nrow - row);
1352 1272
1353 if (rstyle & (RS_RVid | RS_Uline)) 1273 if (rstyle & (RS_RVid | RS_Uline))
1354 ren = (rend_t) ~RS_None; 1274 ren = (rend_t) ~RS_None;
1355 else if (GET_BASEBG (rstyle) == Color_bg) 1275 else if (GET_BASEBG (rstyle) == Color_bg)
1356 { 1276 {
1367 XChangeGC (display->display, gc, GCForeground, &gcvalue); 1287 XChangeGC (display->display, gc, GCForeground, &gcvalue);
1368 } 1288 }
1369 1289
1370 for (; num--; row++) 1290 for (; num--; row++)
1371 { 1291 {
1292 ROW (row).l = 0;
1372 scr_blank_screen_mem (save[row + row_offset], rstyle); 1293 scr_blank_screen_mem (ROW (row), rstyle);
1373 save[row + row_offset].l = 0;
1374 scr_blank_line (drawn[row], 0, ncol, ren); 1294 scr_blank_line (drawn_buf [row], 0, ncol, ren);
1375 } 1295 }
1376} 1296}
1377 1297
1378#if ENABLE_FRILLS 1298#if ENABLE_FRILLS
1379void 1299void
1392 * XTERM_SEQ: Screen Alignment Test: ESC # 8 1312 * XTERM_SEQ: Screen Alignment Test: ESC # 8
1393 */ 1313 */
1394void 1314void
1395rxvt_term::scr_E () 1315rxvt_term::scr_E ()
1396{ 1316{
1397 int i, j, k;
1398 rend_t *r1, fs; 1317 rend_t fs;
1399 1318
1400 want_refresh = 1; 1319 want_refresh = 1;
1401 ZERO_SCROLLBACK (); 1320 ZERO_SCROLLBACK ();
1402 1321
1403 num_scr_allow = 0; 1322 num_scr_allow = 0;
1404 selection_check (3); 1323 selection_check (3);
1405 1324
1406 fs = SET_FONT (rstyle, FONTSET (rstyle)->find_font ('E')); 1325 fs = SET_FONT (rstyle, FONTSET (rstyle)->find_font ('E'));
1407 for (k = saveLines, i = nrow; i--; k++) 1326 for (int row = nrow; row--; )
1408 { 1327 {
1409 line_t &line = save[k]; 1328 line_t &line = ROW(row);
1410 1329
1411 fill_text (line.t, 'E', ncol); 1330 fill_text (line.t, 'E', ncol);
1331 rend_t *r1 = line.r;
1412 1332
1413 for (r1 = line.r, j = ncol; j--; ) 1333 for (int j = ncol; j--; )
1414 *r1++ = fs; 1334 *r1++ = fs;
1415 1335
1416 line.l = ncol; /* make the `E's selectable */ 1336 line.l = ncol; /* make the `E's selectable */
1417 } 1337 }
1418} 1338}
1442 count = end; 1362 count = end;
1443 } 1363 }
1444 1364
1445 scr_do_wrap (); 1365 scr_do_wrap ();
1446 1366
1447 scr_scroll_text (screen.cur.row, screen.bscroll, insdel * count, 0); 1367 scr_scroll_text (screen.cur.row, screen.bscroll, insdel * count);
1448} 1368}
1449 1369
1450/* ------------------------------------------------------------------------- */ 1370/* ------------------------------------------------------------------------- */
1451/* 1371/*
1452 * Insert/Delete <count> characters from the current position 1372 * Insert/Delete <count> characters from the current position
1464 return; 1384 return;
1465 1385
1466 scr_do_wrap (); 1386 scr_do_wrap ();
1467 1387
1468 selection_check (1); 1388 selection_check (1);
1469 MIN_IT (count, (ncol - screen.cur.col)); 1389 min_it (count, ncol - screen.cur.col);
1470 1390
1471 row = screen.cur.row + saveLines; 1391 row = screen.cur.row;
1472 1392
1473 line_t *line = save + row; 1393 line_t *line = &ROW(row);
1474 1394
1475 switch (insdel) 1395 switch (insdel)
1476 { 1396 {
1477 case INSERT: 1397 case INSERT:
1478 for (col = ncol - 1; (col - count) >= screen.cur.col; col--) 1398 for (col = ncol - 1; (col - count) >= screen.cur.col; col--)
1482 } 1402 }
1483 1403
1484 if (!line->is_longer ()) 1404 if (!line->is_longer ())
1485 { 1405 {
1486 line->l += count; 1406 line->l += count;
1487 MIN_IT (line->l, ncol); 1407 min_it (line->l, ncol);
1488 } 1408 }
1489 1409
1490 if (selection.op && current_screen == selection.screen 1410 if (selection.op && current_screen == selection.screen
1491 && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)) 1411 && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur))
1492 { 1412 {
1499 selection.mark.col += count; /* XXX: yes? */ 1419 selection.mark.col += count; /* XXX: yes? */
1500 selection.end.col += count; 1420 selection.end.col += count;
1501 } 1421 }
1502 } 1422 }
1503 1423
1504 scr_blank_line (save[row], screen.cur.col, count, rstyle); 1424 scr_blank_line (*line, screen.cur.col, count, rstyle);
1505 break; 1425 break;
1506 1426
1507 case ERASE: 1427 case ERASE:
1508 screen.cur.col += count; /* don't worry if > ncol */ 1428 screen.cur.col += count; /* don't worry if > ncol */
1509 selection_check (1); 1429 selection_check (1);
1510 screen.cur.col -= count; 1430 screen.cur.col -= count;
1511 scr_blank_line (save[row], screen.cur.col, count, rstyle); 1431 scr_blank_line (*line, screen.cur.col, count, rstyle);
1512 break; 1432 break;
1513 1433
1514 case DELETE: 1434 case DELETE:
1515 tr = line->r[ncol - 1] & (RS_fgMask | RS_bgMask | RS_baseattrMask); 1435 tr = line->r[ncol - 1] & (RS_fgMask | RS_bgMask | RS_baseattrMask);
1516 1436
1523 scr_blank_line (*line, ncol - count, count, tr); 1443 scr_blank_line (*line, ncol - count, count, tr);
1524 1444
1525 if (line->is_longer ()) /* break line continuation */ 1445 if (line->is_longer ()) /* break line continuation */
1526 line->l = ncol; 1446 line->l = ncol;
1527 1447
1528 line->l -= count; 1448 line->l = max (line->l - count, 0);
1529 MAX_IT (line->l, 0);
1530 1449
1531 if (selection.op && current_screen == selection.screen 1450 if (selection.op && current_screen == selection.screen
1532 && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)) 1451 && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur))
1533 { 1452 {
1534 if (selection.end.row != screen.cur.row 1453 if (selection.end.row != screen.cur.row
1554 * XTERM_SEQ: Set region <top> - <bot> inclusive: ESC [ <top> ; <bot> r 1473 * XTERM_SEQ: Set region <top> - <bot> inclusive: ESC [ <top> ; <bot> r
1555 */ 1474 */
1556void 1475void
1557rxvt_term::scr_scroll_region (int top, int bot) 1476rxvt_term::scr_scroll_region (int top, int bot)
1558{ 1477{
1559 MAX_IT (top, 0); 1478 max_it (top, 0);
1560 MIN_IT (bot, (int)nrow - 1); 1479 min_it (bot, nrow - 1);
1561 1480
1562 if (top > bot) 1481 if (top > bot)
1563 return; 1482 return;
1564 1483
1565 screen.tscroll = top; 1484 screen.tscroll = top;
1663 XGCValues gcvalue; 1582 XGCValues gcvalue;
1664 1583
1665 if (rvideo != mode) 1584 if (rvideo != mode)
1666 { 1585 {
1667 rvideo = mode; 1586 rvideo = mode;
1668 SWAP_IT (pix_colors[Color_fg], pix_colors[Color_bg], rxvt_color); 1587 ::swap (pix_colors[Color_fg], pix_colors[Color_bg]);
1669#if XPM_BACKGROUND 1588#if XPM_BACKGROUND
1670 if (bgPixmap.pixmap == None) 1589 if (bgPixmap.pixmap == None)
1671#endif 1590#endif
1672#if TRANSPARENT 1591#if TRANSPARENT
1673 if (! (options & Opt_transparent) || am_transparent == 0) 1592 if (! (options & Opt_transparent) || am_transparent == 0)
1769 bool found = false; 1688 bool found = false;
1770 1689
1771 for (int i = 0; i < nrow; i++) 1690 for (int i = 0; i < nrow; i++)
1772 { 1691 {
1773 int col = 0; 1692 int col = 0;
1774 rend_t *drp = drawn[i].r; 1693 rend_t *drp = drawn_buf[i].r;
1775 1694
1776 for (; col < ncol; col++, drp++) 1695 for (; col < ncol; col++, drp++)
1777 if ((*drp & mask) == value) 1696 if ((*drp & mask) == value)
1778 { 1697 {
1779 found = true; 1698 found = true;
1797rxvt_term::scr_expose (int x, int y, int ewidth, int eheight, bool refresh) 1716rxvt_term::scr_expose (int x, int y, int ewidth, int eheight, bool refresh)
1798{ 1717{
1799 int i; 1718 int i;
1800 row_col_t rc[RC_COUNT]; 1719 row_col_t rc[RC_COUNT];
1801 1720
1802 if (!drawn) /* sanity check */ 1721 if (!drawn_buf) /* sanity check */
1803 return; 1722 return;
1804 1723
1805#ifndef NO_SLOW_LINK_SUPPORT 1724#ifndef NO_SLOW_LINK_SUPPORT
1806 if (refresh_type == FAST_REFRESH && !display->is_local) 1725 if (refresh_type == FAST_REFRESH && !display->is_local)
1807 { 1726 {
1808 y = 0; 1727 y = 0;
1809 eheight = height; 1728 eheight = height;
1810 } 1729 }
1811#endif
1812
1813#ifdef DEBUG_STRICT
1814 x = max (x, 0);
1815 x = min (x, (int)width);
1816 y = max (y, 0);
1817 y = min (y, (int)height);
1818#endif 1730#endif
1819 1731
1820 /* round down */ 1732 /* round down */
1821 rc[PART_BEG].col = Pixel2Col (x); 1733 rc[PART_BEG].col = Pixel2Col (x);
1822 rc[PART_BEG].row = Pixel2Row (y); 1734 rc[PART_BEG].row = Pixel2Row (y);
1825 rc[PART_END].row = Pixel2Row (y + eheight + fheight - 1); 1737 rc[PART_END].row = Pixel2Row (y + eheight + fheight - 1);
1826 1738
1827 /* sanity checks */ 1739 /* sanity checks */
1828 for (i = PART_BEG; i < RC_COUNT; i++) 1740 for (i = PART_BEG; i < RC_COUNT; i++)
1829 { 1741 {
1830 MIN_IT (rc[i].col, ncol - 1); 1742 min_it (rc[i].col, ncol - 1);
1831 MIN_IT (rc[i].row, nrow - 1); 1743 min_it (rc[i].row, nrow - 1);
1832 } 1744 }
1833 1745
1834 for (i = rc[PART_BEG].row; i <= rc[PART_END].row; i++) 1746 for (i = rc[PART_BEG].row; i <= rc[PART_END].row; i++)
1835 fill_text (&drawn[i].t[rc[PART_BEG].col], 0, rc[PART_END].col - rc[PART_BEG].col + 1); 1747 fill_text (&drawn_buf[i].t[rc[PART_BEG].col], 0, rc[PART_END].col - rc[PART_BEG].col + 1);
1836 1748
1837 if (refresh) 1749 if (refresh)
1838 scr_refresh (SLOW_REFRESH); 1750 scr_refresh (SLOW_REFRESH);
1839} 1751}
1840 1752
1941/* ARGSUSED */ 1853/* ARGSUSED */
1942void 1854void
1943rxvt_term::scr_printscreen (int fullhist) 1855rxvt_term::scr_printscreen (int fullhist)
1944{ 1856{
1945#ifdef PRINTPIPE 1857#ifdef PRINTPIPE
1946 int i, r1, nrows, row_offset; 1858 int nrows, row_start;
1947 FILE *fd; 1859 FILE *fd;
1948 1860
1949 if ((fd = popen_printer ()) == NULL) 1861 if ((fd = popen_printer ()) == NULL)
1950 return; 1862 return;
1951 1863
1952 nrows = nrow;
1953 row_offset = saveLines;
1954
1955 if (!fullhist) 1864 if (fullhist)
1956 row_offset -= view_start; 1865 {
1866 nrows = nrow + nsaved;
1867 row_start = -nsaved;
1868 }
1957 else 1869 else
1958 { 1870 {
1959 nrows += nsaved; 1871 nrows = nrow;
1960 row_offset -= nsaved; 1872 row_start = -view_start;
1961 } 1873 }
1962 1874
1963 wctomb (0, 0); 1875 wctomb (0, 0);
1964 1876
1965 for (r1 = 0; r1 < nrows; r1++) 1877 for (int r1 = 0; r1 < nrows; r1++)
1966 { 1878 {
1967 text_t *tp = save[r1 + row_offset].t; 1879 text_t *tp = ROW(r1).t;
1968 int len = save[r1 + row_offset].l; 1880 int len = ROW(r1).l;
1969 1881
1970 for (i = len >= 0 ? len : ncol - 1; i--; ) //TODO//FIXME//LEN 1882 for (int i = len >= 0 ? len : ncol - 1; i--; ) //TODO//FIXME//LEN
1971 { 1883 {
1972 char mb[MB_LEN_MAX]; 1884 char mb[MB_LEN_MAX];
1973 text_t t = *tp++; 1885 text_t t = *tp++;
1974 if (t == NOCHAR) 1886 if (t == NOCHAR)
1975 continue; 1887 continue;
2003{ 1915{
2004 unsigned char must_clear, /* use draw_string not draw_image_string */ 1916 unsigned char must_clear, /* use draw_string not draw_image_string */
2005 showcursor; /* show the cursor */ 1917 showcursor; /* show the cursor */
2006 int16_t col, row, /* column/row we're processing */ 1918 int16_t col, row, /* column/row we're processing */
2007 ocrow; /* old cursor row */ 1919 ocrow; /* old cursor row */
2008 int i, /* tmp */ 1920 int i; /* tmp */
2009 row_offset; /* basic offset in screen structure */
2010#ifndef NO_CURSORCOLOR 1921#ifndef NO_CURSORCOLOR
2011 rend_t cc1; /* store colours at cursor position (s) */ 1922 rend_t cc1; /* store colours at cursor position (s) */
2012#endif 1923#endif
2013 rend_t *crp; // cursor rendition pointer 1924 rend_t *crp; // cursor rendition pointer
2014 1925
2020 /* 1931 /*
2021 * A: set up vars 1932 * A: set up vars
2022 */ 1933 */
2023 must_clear = 0; 1934 must_clear = 0;
2024 refresh_count = 0; 1935 refresh_count = 0;
2025
2026 row_offset = term_start - view_start;
2027 1936
2028#if XPM_BACKGROUND 1937#if XPM_BACKGROUND
2029 must_clear |= bgPixmap.pixmap != None; 1938 must_clear |= bgPixmap.pixmap != None;
2030#endif 1939#endif
2031#if TRANSPARENT 1940#if TRANSPARENT
2101 if (screen.cur.row + view_start != ocrow 2010 if (screen.cur.row + view_start != ocrow
2102 || screen.cur.col != oldcursor.col) 2011 || screen.cur.col != oldcursor.col)
2103 { 2012 {
2104 if (ocrow < nrow 2013 if (ocrow < nrow
2105 && oldcursor.col < ncol) 2014 && oldcursor.col < ncol)
2106 drawn[ocrow].r[oldcursor.col] ^= (RS_RVid | RS_Uline); 2015 drawn_buf[ocrow].r[oldcursor.col] ^= (RS_RVid | RS_Uline);
2107 2016
2108 if (focus || !showcursor) 2017 if (focus || !showcursor)
2109 oldcursor.row = -1; 2018 oldcursor.row = -1;
2110 else 2019 else
2111 setoldcursor = 1; 2020 setoldcursor = 1;
2135 * D: CopyArea pass - very useful for slower links 2044 * D: CopyArea pass - very useful for slower links
2136 * This has been deliberately kept simple. 2045 * This has been deliberately kept simple.
2137 */ 2046 */
2138 i = num_scr; 2047 i = num_scr;
2139 if (!display->is_local 2048 if (!display->is_local
2140 && refresh_type == FAST_REFRESH && num_scr_allow && i 2049 && refresh_type == FAST_REFRESH && num_scr_allow && num_scr
2141 && abs (i) < nrow && !must_clear) 2050 && abs (num_scr) < nrow && !must_clear)
2142 { 2051 {
2143 int16_t nits; 2052 int16_t nits;
2144 int j; 2053 int j;
2145 int len, wlen; 2054 int len, wlen;
2146 2055
2149 row = i > 0 ? 0 : j - 1; 2058 row = i > 0 ? 0 : j - 1;
2150 for (; j-- >= 0; row += (i > 0 ? 1 : -1)) 2059 for (; j-- >= 0; row += (i > 0 ? 1 : -1))
2151 { 2060 {
2152 if (row + i >= 0 && row + i < nrow && row + i != ocrow) 2061 if (row + i >= 0 && row + i < nrow && row + i != ocrow)
2153 { 2062 {
2154 line_t s = save[(row + row_offset) % nlines]; 2063 line_t s = ROW(row - view_start);
2155 line_t d = drawn[row]; 2064 line_t d = drawn_buf[row];
2156 line_t d2 = drawn[row + i]; 2065 line_t d2 = drawn_buf[row + i];
2157 2066
2158 for (nits = 0, col = ncol; col--; ) 2067 for (nits = 0, col = ncol; col--; )
2159 if (s.t[col] != d2.t[col] || s.r[col] != d2.r[col]) 2068 if (s.t[col] != d2.t[col] || s.r[col] != d2.r[col])
2160 nits--; 2069 nits--;
2161 else if (s.t[col] != d.t[col] || s.r[col] != d.r[col]) 2070 else if (s.t[col] != d.t[col] || s.r[col] != d.r[col])
2179 2088
2180 if (len != -1) 2089 if (len != -1)
2181 { 2090 {
2182 /* also comes here at end if needed because of >= above */ 2091 /* also comes here at end if needed because of >= above */
2183 if (wlen < len) 2092 if (wlen < len)
2184 SWAP_IT (wlen, len, int); 2093 ::swap (wlen, len);
2185 2094
2186 XCopyArea (display->display, vt, vt, 2095 XCopyArea (display->display, vt, vt,
2187 gc, 0, Row2Pixel (len + i), 2096 gc, 0, Row2Pixel (len + i),
2188 (unsigned int)TermWin_TotalWidth (), 2097 (unsigned int)TermWin_TotalWidth (),
2189 (unsigned int)Height2Pixel (wlen - len + 1), 2098 (unsigned int)Height2Pixel (wlen - len + 1),
2197 /* 2106 /*
2198 * E: main pass across every character 2107 * E: main pass across every character
2199 */ 2108 */
2200 for (row = 0; row < nrow; row++) 2109 for (row = 0; row < nrow; row++)
2201 { 2110 {
2202 text_t *stp = save[(row + row_offset) % total_rows].t; 2111 text_t *stp = ROW(row - view_start).t;
2203 rend_t *srp = save[(row + row_offset) % total_rows].r; 2112 rend_t *srp = ROW(row - view_start).r;
2204 text_t *dtp = drawn[row].t; 2113 text_t *dtp = drawn_buf[row].t;
2205 rend_t *drp = drawn[row].r; 2114 rend_t *drp = drawn_buf[row].r;
2206 2115
2207 /* 2116 /*
2208 * E2: OK, now the real pass 2117 * E2: OK, now the real pass
2209 */ 2118 */
2210 int ypixel = (int)Row2Pixel (row); 2119 int ypixel = (int)Row2Pixel (row);
2321 fore = Color_UL; 2230 fore = Color_UL;
2322#endif 2231#endif
2323 2232
2324 if (invert) 2233 if (invert)
2325 { 2234 {
2326 SWAP_IT (fore, back, int); 2235 ::swap (fore, back);
2327 2236
2328#ifndef NO_BOLD_UNDERLINE_REVERSE 2237#ifndef NO_BOLD_UNDERLINE_REVERSE
2329 if (ISSET_PIXCOLOR (Color_RV)) 2238 if (ISSET_PIXCOLOR (Color_RV))
2330 back = Color_RV; 2239 back = Color_RV;
2331 2240
2423 2332
2424 while (col && ROW(screen.cur.row).t[col] == NOCHAR) 2333 while (col && ROW(screen.cur.row).t[col] == NOCHAR)
2425 col--; 2334 col--;
2426 2335
2427 while (col + cursorwidth < ncol 2336 while (col + cursorwidth < ncol
2428 && drawn[oldcursor.row].t[col + cursorwidth] == NOCHAR) 2337 && drawn_buf[oldcursor.row].t[col + cursorwidth] == NOCHAR)
2429 cursorwidth++; 2338 cursorwidth++;
2430 2339
2431#ifndef NO_CURSORCOLOR 2340#ifndef NO_CURSORCOLOR
2432 if (ISSET_PIXCOLOR (Color_cursor)) 2341 if (ISSET_PIXCOLOR (Color_cursor))
2433 XSetForeground (display->display, gc, pix_colors[Color_cursor]); 2342 XSetForeground (display->display, gc, pix_colors[Color_cursor]);
2465 2374
2466void 2375void
2467rxvt_term::scr_remap_chars () 2376rxvt_term::scr_remap_chars ()
2468{ 2377{
2469 for (int i = total_rows; i--; ) 2378 for (int i = total_rows; i--; )
2470 scr_remap_chars (save[i]); 2379 scr_remap_chars (row_buf [i]);
2471 2380
2472 for (int i = nrow; i--; ) 2381 for (int i = nrow; i--; )
2473 { 2382 {
2474 scr_remap_chars (drawn[i]); 2383 scr_remap_chars (drawn_buf [i]);
2475 scr_remap_chars (swap_save[i]); 2384 scr_remap_chars (swap_buf [i]);
2476 } 2385 }
2477} 2386}
2478 2387
2479void 2388void
2480rxvt_term::scr_recolour () 2389rxvt_term::scr_recolour ()
2547 row = selection.beg.row; 2456 row = selection.beg.row;
2548 } 2457 }
2549 else 2458 else
2550 { 2459 {
2551 col = 0; 2460 col = 0;
2552 row = view_start; 2461 row = -view_start;
2553 } 2462 }
2554 2463
2555 for (; row < min (selection.end.row, view_end); row++, col = 0) 2464 for (; row < min (selection.end.row, view_end); row++, col = 0)
2556 for (rend_t *srp = ROW(row).r; col < ncol; col++) 2465 for (rend_t *srp = ROW(row).r; col < ncol; col++)
2557 srp[col] ^= RS_RVid; 2466 srp[col] ^= RS_RVid;
2577 char r1[] = "\n"; 2486 char r1[] = "\n";
2578 2487
2579 for (row = saveLines - nsaved; 2488 for (row = saveLines - nsaved;
2580 row < saveLines + nrow - 1; row++) 2489 row < saveLines + nrow - 1; row++)
2581 { 2490 {
2582 width = save[row].l >= 0 ? save[row].l 2491 width = row_buf[row].l >= 0 ? row_buf[row].l
2583 : ncol; 2492 : ncol;
2584 for (towrite = width; towrite; towrite -= wrote) 2493 for (towrite = width; towrite; towrite -= wrote)
2585 { 2494 {
2586 wrote = write (fd, & (save[row].t[width - towrite]), 2495 wrote = write (fd, & (row_buf[row].t[width - towrite]),
2587 towrite); 2496 towrite);
2588 if (wrote < 0) 2497 if (wrote < 0)
2589 return; /* XXX: death, no report */ 2498 return; /* XXX: death, no report */
2590 } 2499 }
2591 if (save[row].l >= 0) 2500 if (row_buf[row].l >= 0)
2592 if (write (fd, r1, 1) <= 0) 2501 if (write (fd, r1, 1) <= 0)
2593 return; /* XXX: death, no report */ 2502 return; /* XXX: death, no report */
2594 } 2503 }
2595} 2504}
2596#endif 2505#endif
3073 want_refresh = 1; 2982 want_refresh = 1;
3074 2983
3075 selection.mark.row = row - view_start; 2984 selection.mark.row = row - view_start;
3076 selection.mark.col = col; 2985 selection.mark.col = col;
3077 2986
3078 selection.mark.row = min (max (selection.mark.row, -nsaved), nrow - 1); 2987 selection.mark.row = clamp (selection.mark.row, -nsaved, nrow - 1);
3079 selection.mark.col = min (max (selection.mark.col, 0), ncol - 1); 2988 selection.mark.col = clamp (selection.mark.col, 0, ncol - 1);
3080 2989
3081 while (selection.mark.col > 0 2990 while (selection.mark.col > 0
3082 && ROW(selection.mark.row).t[selection.mark.col] == NOCHAR) 2991 && ROW(selection.mark.row).t[selection.mark.col] == NOCHAR)
3083 --selection.mark.col; 2992 --selection.mark.col;
3084 2993
3189 * flag == 2 ==> button 3 motion 3098 * flag == 2 ==> button 3 motion
3190 */ 3099 */
3191void 3100void
3192rxvt_term::selection_extend (int x, int y, int flag) 3101rxvt_term::selection_extend (int x, int y, int flag)
3193{ 3102{
3194 int col = min (max (Pixel2Col (x), 0), nrow - 1); 3103 int col = clamp (Pixel2Col (x), 0, ncol);
3195 int row = min (max (Pixel2Row (y), 0), ncol); 3104 int row = clamp (Pixel2Row (y), 0, nrow - 1);
3196 3105
3197 /* 3106 /*
3198 * If we're selecting characters (single click) then we must check first 3107 * 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 3108 * 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 3109 * 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++) 3280 for (int end_row = selection.mark.row; end_row < nrow; end_row++)
3372 { 3281 {
3373 if (!ROW(end_row).is_longer ()) 3282 if (!ROW(end_row).is_longer ())
3374 { 3283 {
3375 selection.end.row = end_row; 3284 selection.end.row = end_row;
3376 selection.end.col = save[end_row + saveLines].l; 3285 selection.end.col = ROW(end_row).l;
3377 selection_remove_trailing_spaces (); 3286 selection_remove_trailing_spaces ();
3378 break; 3287 break;
3379 } 3288 }
3380 } 3289 }
3381 } 3290 }
3413 } 3322 }
3414 } 3323 }
3415 3324
3416#if ENABLE_FRILLS 3325#if ENABLE_FRILLS
3417 if (selection.rect && selection.beg.col > selection.end.col) 3326 if (selection.rect && selection.beg.col > selection.end.col)
3418 SWAP_IT (selection.beg.col, selection.end.col, int); 3327 ::swap (selection.beg.col, selection.end.col);
3419#endif 3328#endif
3420} 3329}
3421 3330
3422#if ENABLE_FRILLS 3331#if ENABLE_FRILLS
3423void 3332void
3621 */ 3530 */
3622void 3531void
3623rxvt_term::pixel_position (int *x, int *y) 3532rxvt_term::pixel_position (int *x, int *y)
3624{ 3533{
3625 *x = Pixel2Col (*x); 3534 *x = Pixel2Col (*x);
3626 /* MAX_IT (*x, 0); MIN_IT (*x, (int)ncol - 1); */ 3535 /* max_it (*x, 0); min_it (*x, (int)ncol - 1); */
3627 *y = Pixel2Row (*y); 3536 *y = Pixel2Row (*y);
3628 /* MAX_IT (*y, 0); MIN_IT (*y, (int)nrow - 1); */ 3537 /* max_it (*y, 0); min_it (*y, (int)nrow - 1); */
3629} 3538}
3630 3539
3631/* ------------------------------------------------------------------------- */ 3540/* ------------------------------------------------------------------------- */
3632#ifdef USE_XIM 3541#ifdef USE_XIM
3633void 3542void
3655 3564
3656 if (x < 0) x = ncol - w; 3565 if (x < 0) x = ncol - w;
3657 if (y < 0) y = nrow - h; 3566 if (y < 0) y = nrow - h;
3658 3567
3659 // make space for border 3568 // make space for border
3660 w += 2; MIN_IT (w, ncol); 3569 w += 2; min_it (w, ncol);
3661 h += 2; MIN_IT (h, nrow); 3570 h += 2; min_it (h, nrow);
3662 3571
3663 x -= 1; MAX_IT (x, 0); 3572 x -= 1; clamp_it (x, 0, ncol - w);
3664 y -= 1; MAX_IT (y, 0); 3573 y -= 1; clamp_it (y, 0, nrow - h);
3665
3666 MIN_IT (x, ncol - w);
3667 MIN_IT (y, nrow - h);
3668 3574
3669 ov_x = x; ov_y = y; 3575 ov_x = x; ov_y = y;
3670 ov_w = w; ov_h = h; 3576 ov_w = w; ov_h = h;
3671 3577
3672 ov_text = new text_t *[h]; 3578 ov_text = new text_t *[h];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines