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.85 by root, Sun Aug 8 16:43:21 2004 UTC vs.
Revision 1.89 by root, Fri Aug 13 22:38:57 2004 UTC

172 nrow = TermWin.nrow; 172 nrow = TermWin.nrow;
173 173
174 if (ncol == prev_ncol && nrow == prev_nrow) 174 if (ncol == prev_ncol && nrow == prev_nrow)
175 return; 175 return;
176 176
177 // we need at least two lines for wrapping to work correctly
178 if (nrow + TermWin.saveLines < 2)
179 {
180 TermWin.saveLines++;
181 prev_nrow--;
182 TermWin.nscrolled++;
183 }
184
177 want_refresh = 1; 185 want_refresh = 1;
178 186
187 prev_total_rows = prev_nrow + TermWin.saveLines;
179 total_rows = nrow + TermWin.saveLines; 188 total_rows = nrow + TermWin.saveLines;
180 prev_total_rows = prev_nrow + TermWin.saveLines;
181 189
182 screen.tscroll = 0; 190 screen.tscroll = 0;
183 screen.bscroll = nrow - 1; 191 screen.bscroll = nrow - 1;
184 192
185 if (!talloc) 193 if (!talloc)
186 { 194 {
187 talloc = new rxvt_salloc (ncol * sizeof (text_t)); 195 talloc = new rxvt_salloc (ncol * sizeof (text_t));
188 ralloc = new rxvt_salloc (ncol * sizeof (rend_t)); 196 ralloc = new rxvt_salloc (ncol * sizeof (rend_t));
189 } 197 }
190 198
191 if (prev_nrow == 0) 199 if (!screen.text)
192 { 200 {
193 /* 201 /*
194 * first time called so just malloc everything: don't rely on realloc 202 * 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 203 * Note: this is still needed so that all the scrollback lines are NULL
196 */ 204 */
783 /* _at least_ this many lines need to be scrolled */ 791 /* _at least_ this many lines need to be scrolled */
784 scr_scroll_text (screen.tscroll, screen.bscroll, nlines, 0); 792 scr_scroll_text (screen.tscroll, screen.bscroll, nlines, 0);
785 screen.cur.row -= nlines; 793 screen.cur.row -= nlines;
786 } 794 }
787 } 795 }
796
788#ifdef DEBUG_STRICT 797#ifdef DEBUG_STRICT
789 assert (screen.cur.col < last_col); 798 assert (screen.cur.col < last_col);
790 assert ((screen.cur.row < TermWin.nrow) 799 assert ((screen.cur.row < TermWin.nrow)
791 && (screen.cur.row >= - (int32_t)TermWin.nscrolled)); 800 && (screen.cur.row >= - (int32_t)TermWin.nscrolled));
792#else /* drive with your eyes closed */ 801#else /* drive with your eyes closed */
2558 if (ct.encoding == 0) 2567 if (ct.encoding == 0)
2559 { 2568 {
2560 D_SELECT ((stderr, "rxvt_selection_paste: property didn't exist!")); 2569 D_SELECT ((stderr, "rxvt_selection_paste: property didn't exist!"));
2561 break; 2570 break;
2562 } 2571 }
2572 else if (ct.encoding == xa[XA_INCR])
2573 {
2574 // INCR selection, start handshake
2575 XDeleteProperty (display->display, win, prop);
2576 selection_wait = Sel_incr;
2577 incr_ev.start (NOW + 10);
2578 break;
2579 }
2563 2580
2564 if (ct.value == NULL) 2581 if (ct.value == NULL)
2565 { 2582 {
2566 D_SELECT ((stderr, "rxvt_selection_paste: property shooting blanks!")); 2583 D_SELECT ((stderr, "rxvt_selection_paste: property shooting blanks!"));
2567 continue; 2584 continue;
2628 * INCR support originally provided by Paul Sheer <psheer@obsidian.co.za> 2645 * INCR support originally provided by Paul Sheer <psheer@obsidian.co.za>
2629 */ 2646 */
2630void 2647void
2631rxvt_term::selection_property (Window win, Atom prop) 2648rxvt_term::selection_property (Window win, Atom prop)
2632{ 2649{
2633 int reget_time = 0; 2650 if (prop == None || selection_wait != Sel_incr)
2634
2635 if (prop == None)
2636 return; 2651 return;
2637 2652
2638 D_SELECT ((stderr, "rxvt_selection_property (%08lx, %lu)", win, (unsigned long)prop));
2639 if (selection_wait == Sel_normal)
2640 {
2641 int a, afmt;
2642 Atom atype;
2643 unsigned long bytes_after, nitems;
2644 unsigned char *s = NULL;
2645
2646 a = XGetWindowProperty (display->display, win, prop, 0L, 1L, False,
2647 xa[XA_INCR], &atype, &afmt, &nitems,
2648 &bytes_after, &s);
2649 if (s)
2650 XFree (s);
2651 if (a != Success)
2652 return;
2653
2654#ifndef __CYGWIN32__
2655 if (atype == xa[XA_INCR])
2656 { /* start an INCR transfer */
2657 D_SELECT ((stderr, "rxvt_selection_property: INCR: starting transfer"));
2658 XDeleteProperty (display->display, win, prop);
2659 XFlush (display->display);
2660 reget_time = 1;
2661 selection_wait = Sel_incr;
2662 }
2663#endif
2664
2665 }
2666 else if (selection_wait == Sel_incr)
2667 {
2668 reget_time = 1;
2669
2670 if (selection_paste (win, prop, True) == -1) 2653 if (selection_paste (win, prop, 1) > 0)
2671 {
2672 D_SELECT ((stderr, "rxvt_selection_property: INCR: clean end"));
2673 selection_wait = Sel_none;
2674 incr_ev.stop ();
2675 }
2676 }
2677 if (reget_time) /* received more data so reget time */
2678 incr_ev.start (NOW + 10); 2654 incr_ev.start (NOW + 10);
2655 else
2656 {
2657 selection_wait = Sel_none;
2658 incr_ev.stop ();
2659 }
2679} 2660}
2680 2661
2681/* ------------------------------------------------------------------------- */ 2662/* ------------------------------------------------------------------------- */
2682/* 2663/*
2683 * Request the current selection: 2664 * Request the current selection:
3388 (8 * sizeof (target_list[0])), PropModeReplace, 3369 (8 * sizeof (target_list[0])), PropModeReplace,
3389 (unsigned char *)target_list, 3370 (unsigned char *)target_list,
3390 target - target_list); 3371 target - target_list);
3391 ev.property = rq.property; 3372 ev.property = rq.property;
3392 } 3373 }
3374#if TODO // TODO
3393 else if (rq.target == xa[XA_MULTIPLE]) 3375 else if (rq.target == xa[XA_MULTIPLE])
3394 { 3376 {
3395 /* TODO: Handle MULTIPLE */ 3377 /* TODO: Handle MULTIPLE */
3396 } 3378 }
3379#endif
3397 else if (rq.target == xa[XA_TIMESTAMP] && selection.text) 3380 else if (rq.target == xa[XA_TIMESTAMP] && selection.text)
3398 { 3381 {
3399 XChangeProperty (display->display, rq.requestor, rq.property, XA_INTEGER, 3382 XChangeProperty (display->display, rq.requestor, rq.property, XA_INTEGER,
3400 (8 * sizeof (Time)), PropModeReplace, 3383 (8 * sizeof (Time)), PropModeReplace,
3401 (unsigned char *)&selection_time, 1); 3384 (unsigned char *)&selection_time, 1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines