ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/command.C
(Generate patch)

Comparing rxvt-unicode/src/command.C (file contents):
Revision 1.90 by pcg, Fri Apr 2 19:09:52 2004 UTC vs.
Revision 1.93 by pcg, Thu Apr 8 20:31:45 2004 UTC

1/*--------------------------------*-C-*---------------------------------* 1/*--------------------------------*-C-*---------------------------------*
2 * File: command.c 2 * File: command.C
3 *----------------------------------------------------------------------* 3 *----------------------------------------------------------------------*
4 * 4 *
5 * All portions of code are copyright by their respective author/s. 5 * All portions of code are copyright by their respective author/s.
6 * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> 6 * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk>
7 * - original version 7 * - original version
672 scr_refresh (refresh_type); 672 scr_refresh (refresh_type);
673 scrollbar_show (1); 673 scrollbar_show (1);
674#ifdef USE_XIM 674#ifdef USE_XIM
675 IMSendSpot (); 675 IMSendSpot ();
676#endif 676#endif
677
678 } 677 }
679 678
680 display->flush (); 679 display->flush ();
681} 680}
682 681
715 714
716bool 715bool
717rxvt_term::pty_fill () 716rxvt_term::pty_fill ()
718{ 717{
719 ssize_t n = cmdbuf_endp - cmdbuf_ptr; 718 ssize_t n = cmdbuf_endp - cmdbuf_ptr;
719
720 if (CBUFSIZ == n)
721 {
722 rxvt_warn ("pty_fill on full buffer, draining input, continuing.\n");
723 n = 0;
724 }
720 725
721 memmove (cmdbuf_base, cmdbuf_ptr, n); 726 memmove (cmdbuf_base, cmdbuf_ptr, n);
722 cmdbuf_ptr = cmdbuf_base; 727 cmdbuf_ptr = cmdbuf_base;
723 cmdbuf_endp = cmdbuf_ptr + n; 728 cmdbuf_endp = cmdbuf_ptr + n;
724 729
742 SET_LOCALE (locale); 747 SET_LOCALE (locale);
743 748
744 if (revents & EVENT_WRITE) 749 if (revents & EVENT_WRITE)
745 tt_write (0, 0); 750 tt_write (0, 0);
746 else if (revents & EVENT_READ) 751 else if (revents & EVENT_READ)
747 {
748 // loop, but don't allow a single term to monopolize us 752 // loop, but don't allow a single term to monopolize us
749 // the number of loops is fully arbitrary, and thus wrong
750 while (pty_fill ()) 753 while (pty_fill ())
751 {
752 if (!seen_input)
753 {
754 seen_input = 1;
755 /* once we know the shell is running, send the screen size. Again! */
756 // I don't know why, btw.
757 tt_winch ();
758 }
759
760 if (cmd_parse ()) 754 if (cmd_parse ())
761 break; 755 break;
762 }
763 }
764} 756}
765 757
766#ifdef POINTER_BLANK 758#ifdef POINTER_BLANK
767void 759void
768rxvt_term::pointer_unblank () 760rxvt_term::pointer_unblank ()
1013 && (ev.xclient.data.l[0] == DndFile 1005 && (ev.xclient.data.l[0] == DndFile
1014 || ev.xclient.data.l[0] == DndDir 1006 || ev.xclient.data.l[0] == DndDir
1015 || ev.xclient.data.l[0] == DndLink)) 1007 || ev.xclient.data.l[0] == DndLink))
1016 { 1008 {
1017 /* Get Dnd data */ 1009 /* Get Dnd data */
1018 Atom ActualType; 1010 Atom ActualType;
1019 int ActualFormat; 1011 int ActualFormat;
1020 unsigned char *data; 1012 unsigned char *data;
1021 unsigned long Size, RemainingBytes; 1013 unsigned long Size, RemainingBytes;
1022 1014
1023 XGetWindowProperty (display->display, display->root, 1015 XGetWindowProperty (display->display, display->root,
1024 xa[XA_DNDSELECTION], 1016 xa[XA_DNDSELECTION],
1025 0L, 1000000L, 1017 0L, 1000000L,
1026 False, AnyPropertyType, 1018 False, AnyPropertyType,
1029 &data); 1021 &data);
1030 XChangeProperty (display->display, display->root, 1022 XChangeProperty (display->display, display->root,
1031 XA_CUT_BUFFER0, XA_STRING, 1023 XA_CUT_BUFFER0, XA_STRING,
1032 8, PropModeReplace, 1024 8, PropModeReplace,
1033 data, STRLEN (data)); 1025 data, STRLEN (data));
1026 XFree (data);
1034 selection_paste (display->root, XA_CUT_BUFFER0, True); 1027 selection_paste (display->root, XA_CUT_BUFFER0, True);
1035 XSetInputFocus (display->display, display->root, RevertToNone, CurrentTime); 1028 XSetInputFocus (display->display, display->root, RevertToNone, CurrentTime);
1036 } 1029 }
1037#endif /* OFFIX_DND */ 1030#endif /* OFFIX_DND */
1038 break; 1031 break;
1996 if (!i || prop == NULL) 1989 if (!i || prop == NULL)
1997 have_pixmap = 0; 1990 have_pixmap = 0;
1998 else 1991 else
1999 { 1992 {
2000 have_pixmap = 1; 1993 have_pixmap = 1;
2001 rootpixmap = * ((Pixmap *)prop); 1994 rootpixmap = *(Pixmap *)prop;
2002 XFree (prop); 1995 XFree (prop);
2003 } 1996 }
2004 1997
2005 if (have_pixmap) 1998 if (have_pixmap)
2006 { 1999 {
2191 } 2184 }
2192 2185
2193 if (ch == NOCHAR) // TODO: improve 2186 if (ch == NOCHAR) // TODO: improve
2194 break; 2187 break;
2195 2188
2196 if (!IS_CONTROL (ch) || ch == '\t' || ch == '\n' || ch == '\r') 2189 if (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT)
2197 { 2190 {
2198 /* Read a text string from the input buffer */ 2191 /* Read a text string from the input buffer */
2199 unicode_t buf[UBUFSIZ]; 2192 unicode_t buf[UBUFSIZ];
2200 bool refreshnow = false; 2193 bool refreshnow = false;
2201 int nlines = 0; 2194 int nlines = 0;
2206 for (;;) 2199 for (;;)
2207 { 2200 {
2208 seq_begin = cmdbuf_ptr; 2201 seq_begin = cmdbuf_ptr;
2209 ch = next_char (); 2202 ch = next_char ();
2210 2203
2211 if (ch == NOCHAR || (IS_CONTROL (ch) && ch != '\t' && ch != '\n' && ch != '\r')) 2204 if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT))
2212 break; 2205 break;
2213 2206
2214 *str++ = ch; 2207 *str++ = ch;
2215 2208
2216 if (ch == '\n') 2209 if (ch == C0_LF)
2217 { 2210 {
2218 nlines++; 2211 nlines++;
2219 refresh_count++; 2212 refresh_count++;
2220 2213
2221 if (! (Options & Opt_jumpScroll) 2214 if (! (Options & Opt_jumpScroll)
2256 */ 2249 */
2257 if (refreshnow) 2250 if (refreshnow)
2258 { 2251 {
2259 if ((Options & Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) 2252 if ((Options & Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD)
2260 refresh_limit++; 2253 refresh_limit++;
2261 2254 else
2262 scr_refresh (refresh_type); 2255 scr_refresh (refresh_type);
2263 } 2256 }
2264 2257
2265 } 2258 }
2266 else 2259 else
2267 { 2260 {
2597 break; 2590 break;
2598 2591
2599 /* 8.3.87: NEXT LINE */ 2592 /* 8.3.87: NEXT LINE */
2600 case C1_NEL: /* ESC E */ 2593 case C1_NEL: /* ESC E */
2601 { 2594 {
2602 unicode_t nlcr[] = { L'\n', L'\r' }; 2595 unicode_t nlcr[] = { C0_LF, C0_CR };
2603 scr_add_lines (nlcr, 1, 2); 2596 scr_add_lines (nlcr, 1, 2);
2604 } 2597 }
2605 break; 2598 break;
2606 2599
2607 /* kidnapped escape sequence: Should be 8.3.48 */ 2600 /* kidnapped escape sequence: Should be 8.3.48 */
3092#endif 3085#endif
3093 3086
3094/*----------------------------------------------------------------------*/ 3087/*----------------------------------------------------------------------*/
3095/* 3088/*
3096 * get input up until STRING TERMINATOR (or BEL) 3089 * get input up until STRING TERMINATOR (or BEL)
3097 * ends_how is terminator used. returned input must be free ()d 3090 * ends_how is terminator used. returned input must be free()'d
3098 */ 3091 */
3099unsigned char * 3092unsigned char *
3100rxvt_term::get_to_st (unicode_t &ends_how) 3093rxvt_term::get_to_st (unicode_t &ends_how)
3101{ 3094{
3102 int seen_esc = 0; /* seen escape? */ 3095 int seen_esc = 0; /* seen escape? */
3119 if (ch == C0_ESC) 3112 if (ch == C0_ESC)
3120 { 3113 {
3121 seen_esc = 1; 3114 seen_esc = 1;
3122 continue; 3115 continue;
3123 } 3116 }
3124 else if (ch == '\t') 3117 else if (ch == C0_HT)
3125 ch = ' '; /* translate '\t' to space */ 3118 ch = ' '; /* translate '\t' to space */
3126 else if (ch < 0x20 && (ch != 0x0a && ch != 0x0d)) 3119 else if (ch < 0x20 && (ch != C0_LF && ch != C0_CR))
3127 return NULL; /* other control character - exit */ 3120 return NULL; /* other control character - exit */
3128 3121
3129 if (n >= sizeof (string) - 1) 3122 if (n >= sizeof (string) - 1)
3130 // stop at some sane length 3123 // stop at some sane length
3131 return NULL; 3124 return NULL;
3700 rendset = 1, rendstyle = RS_Uline; 3693 rendset = 1, rendstyle = RS_Uline;
3701 break; 3694 break;
3702 case 5: 3695 case 5:
3703 rendset = 1, rendstyle = RS_Blink; 3696 rendset = 1, rendstyle = RS_Blink;
3704 break; 3697 break;
3698 //case 6: // scoansi light background
3705 case 7: 3699 case 7:
3706 rendset = 1, rendstyle = RS_RVid; 3700 rendset = 1, rendstyle = RS_RVid;
3707 break; 3701 break;
3708 case 8: 3702 case 8:
3709 // invisible. NYI 3703 // invisible. NYI
3704 break;
3705 //case 10: // scoansi acs off
3706 //case 11: // scoansi acs on
3707 //case 12: // scoansi acs on, |0x80
3708 case 21: // disable bold, blink and invis (some terminals use this)
3709 rendset = 0, rendstyle = RS_Bold | RS_Blink;
3710 break; 3710 break;
3711 case 22: 3711 case 22:
3712 rendset = 0, rendstyle = RS_Bold; 3712 rendset = 0, rendstyle = RS_Bold;
3713 break; 3713 break;
3714 case 24: 3714 case 24:
3807 } 3807 }
3808 } 3808 }
3809} 3809}
3810/*}}} */ 3810/*}}} */
3811 3811
3812/*{{{ process Rob Nation's own graphics mode sequences */ 3812/*{{{ (do not) process Rob Nation's own graphics mode sequences */
3813void 3813void
3814rxvt_term::process_graphics () 3814rxvt_term::process_graphics ()
3815{ 3815{
3816 unicode_t ch, cmd = cmd_getc (); 3816 unicode_t ch, cmd = cmd_getc ();
3817 3817

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines