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.93 by pcg, Thu Apr 8 20:31:45 2004 UTC vs.
Revision 1.107 by root, Sat Jul 31 00:01:12 2004 UTC

710 w.start (w.at + TEXT_BLINK_INTERVAL); 710 w.start (w.at + TEXT_BLINK_INTERVAL);
711 } 711 }
712} 712}
713#endif 713#endif
714 714
715#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
716void
717rxvt_term::cont_scroll_cb (time_watcher &w)
718{
719 if ((scrollbar_isUp() || scrollbar_isDn()) &&
720 scr_page (scrollbar_isUp() ? UP : DN, 1))
721 {
722 refresh_type |= SMOOTH_REFRESH;
723 want_refresh = 1;
724 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY);
725 }
726}
727#endif
728
729#ifdef SELECTION_SCROLLING
730void
731rxvt_term::sel_scroll_cb (time_watcher &w)
732{
733 if (scr_page (scroll_selection_dir, scroll_selection_lines))
734 {
735 selection_extend (selection_save_x, selection_save_y, selection_save_state);
736 refresh_type |= SMOOTH_REFRESH;
737 want_refresh = 1;
738 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY);
739 }
740}
741#endif
742
743#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)
744void
745rxvt_term::slip_wheel_cb (time_watcher &w)
746{
747 if (mouse_slip_wheel_speed == 0
748 || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed)
749 : scr_page (UP, mouse_slip_wheel_speed))
750 {
751 refresh_type |= SMOOTH_REFRESH;
752 want_refresh = 1;
753 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY);
754 }
755}
756#endif
757
715bool 758bool
716rxvt_term::pty_fill () 759rxvt_term::pty_fill ()
717{ 760{
718 ssize_t n = cmdbuf_endp - cmdbuf_ptr; 761 ssize_t n = cmdbuf_endp - cmdbuf_ptr;
719 762
753 while (pty_fill ()) 796 while (pty_fill ())
754 if (cmd_parse ()) 797 if (cmd_parse ())
755 break; 798 break;
756} 799}
757 800
758#ifdef POINTER_BLANK
759void 801void
760rxvt_term::pointer_unblank () 802rxvt_term::pointer_unblank ()
761{ 803{
762 XDefineCursor (display->display, TermWin.vt, TermWin_cursor); 804 XDefineCursor (display->display, TermWin.vt, TermWin_cursor);
763 recolour_cursor (); 805 recolour_cursor ();
764 806
807#ifdef POINTER_BLANK
765 hidden_pointer = 0; 808 hidden_pointer = 0;
766 809
767 if (Options & Opt_pointerBlank) 810 if (Options & Opt_pointerBlank)
768 pointer_ev.start (NOW + pointerBlankDelay); 811 pointer_ev.start (NOW + pointerBlankDelay);
812#endif
769} 813}
770 814
815#ifdef POINTER_BLANK
771void 816void
772rxvt_term::pointer_blank () 817rxvt_term::pointer_blank ()
773{ 818{
774 if (! (Options & Opt_pointerBlank)) 819 if (! (Options & Opt_pointerBlank))
775 return; 820 return;
971 break; 1016 break;
972 1017
973#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) 1018#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)
974 case KeyRelease: 1019 case KeyRelease:
975 { 1020 {
976 if (! (ev.xkey.state & ControlMask)) 1021 if (!(ev.xkey.state & ControlMask))
977 mouse_slip_wheel_speed = 0; 1022 slip_wheel_ev.stop ();
978 else 1023 else
979 { 1024 {
980 KeySym ks; 1025 KeySym ks;
981 1026
982 ks = XKeycodeToKeysym (display->display, ev.xkey.keycode, 0); 1027 ks = XKeycodeToKeysym (display->display, ev.xkey.keycode, 0);
983 if (ks == XK_Control_L || ks == XK_Control_R) 1028 if (ks == XK_Control_L || ks == XK_Control_R)
984 mouse_slip_wheel_speed = 0; 1029 mouse_slip_wheel_speed = 0;
985 } 1030 }
1070#endif 1115#endif
1071#ifdef CURSOR_BLINK 1116#ifdef CURSOR_BLINK
1072 if (Options & Opt_cursorBlink) 1117 if (Options & Opt_cursorBlink)
1073 cursor_blink_ev.start (NOW + BLINK_INTERVAL); 1118 cursor_blink_ev.start (NOW + BLINK_INTERVAL);
1074#endif 1119#endif
1120#ifdef OFF_FOCUS_FADING
1121 if (rs[Rs_fade])
1122 {
1123 PixColors = PixColorsFocused;
1124 set_colorfgbg ();
1125 scr_clear ();
1126 scr_touch (true);
1127 }
1128#endif
1075 1129
1076 } 1130 }
1077 break; 1131 break;
1078 1132
1079 case FocusOut: 1133 case FocusOut:
1087#endif 1141#endif
1088#ifdef CURSOR_BLINK 1142#ifdef CURSOR_BLINK
1089 if (Options & Opt_cursorBlink) 1143 if (Options & Opt_cursorBlink)
1090 cursor_blink_ev.stop (); 1144 cursor_blink_ev.stop ();
1091 hidden_cursor = 0; 1145 hidden_cursor = 0;
1146#endif
1147#ifdef OFF_FOCUS_FADING
1148 if (rs[Rs_fade])
1149 {
1150 PixColors = PixColorsUnFocused;
1151 set_colorfgbg ();
1152 scr_clear ();
1153 scr_touch (true);
1154 }
1092#endif 1155#endif
1093 1156
1094 } 1157 }
1095 break; 1158 break;
1096 1159
1169 { 1232 {
1170#ifdef NO_SLOW_LINK_SUPPORT 1233#ifdef NO_SLOW_LINK_SUPPORT
1171 scr_expose (ev.xexpose.x, ev.xexpose.y, 1234 scr_expose (ev.xexpose.x, ev.xexpose.y,
1172 ev.xexpose.width, ev.xexpose.height, False); 1235 ev.xexpose.width, ev.xexpose.height, False);
1173#else 1236#else
1174 // don't understand this, so commented it out 1237 // I don't understand this, so I changed it :)
1175 scr_expose (ev.xexpose.x, ev.xexpose.y, 1238 scr_expose (ev.xexpose.x, ev.xexpose.y,
1176 ev.xexpose.width, ev.xexpose.height, False); 1239 ev.xexpose.width, ev.xexpose.height, False);
1177 //scr_expose (ev.xexpose.x, 0, 1240 //scr_expose (ev.xexpose.x, 0,
1178 // ev.xexpose.width, TermWin.height, False); 1241 // ev.xexpose.width, TermWin.height, False);
1179#endif 1242#endif
1181 } 1244 }
1182 else 1245 else
1183 { 1246 {
1184 XEvent unused_event; 1247 XEvent unused_event;
1185 1248
1186 while (XCheckTypedWindowEvent (display->display, ev.xany.window, 1249 while (XCheckTypedWindowEvent (display->display, ev.xany.window, Expose, &unused_event))
1187 Expose, 1250 ;
1188 &unused_event)) ;
1189 while (XCheckTypedWindowEvent (display->display, ev.xany.window, 1251 while (XCheckTypedWindowEvent (display->display, ev.xany.window, GraphicsExpose, &unused_event))
1190 GraphicsExpose, 1252 ;
1191 &unused_event)) ; 1253
1192 if (isScrollbarWindow (ev.xany.window)) 1254 if (isScrollbarWindow (ev.xany.window))
1193 { 1255 {
1194 scrollBar.setIdle (); 1256 scrollBar.setIdle ();
1195 scrollbar_show (0); 1257 scrollbar_show (0);
1196 } 1258 }
1239 if (ev.xbutton.y < TermWin.int_bwidth 1301 if (ev.xbutton.y < TermWin.int_bwidth
1240 || Pixel2Row (ev.xbutton.y) > (TermWin.nrow-1)) 1302 || Pixel2Row (ev.xbutton.y) > (TermWin.nrow-1))
1241 { 1303 {
1242 int dist; 1304 int dist;
1243 1305
1244 pending_scroll_selection=1;
1245
1246 /* don't clobber the current delay if we are 1306 /* don't clobber the current delay if we are
1247 * already in the middle of scrolling. 1307 * already in the middle of scrolling.
1248 */ 1308 */
1249 if (scroll_selection_delay<=0) 1309 if (!sel_scroll_ev.active)
1250 scroll_selection_delay=SCROLLBAR_CONTINUOUS_DELAY; 1310 sel_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY);
1251 1311
1252 /* save the event params so we can highlight 1312 /* save the event params so we can highlight
1253 * the selection in the pending-scroll loop 1313 * the selection in the pending-scroll loop
1254 */ 1314 */
1255 selection_save_x=ev.xbutton.x; 1315 selection_save_x=ev.xbutton.x;
1277 else 1337 else
1278 { 1338 {
1279 /* we are within the text window, so we 1339 /* we are within the text window, so we
1280 * shouldn't be scrolling 1340 * shouldn't be scrolling
1281 */ 1341 */
1282 pending_scroll_selection = 0; 1342 if (sel_scroll_ev.active)
1343 sel_scroll_ev.stop();
1283 } 1344 }
1284#endif 1345#endif
1285#ifdef MOUSE_THRESHOLD 1346#ifdef MOUSE_THRESHOLD
1286 1347
1287 } 1348 }
1504 upordown = 1; /* down */ 1565 upordown = 1; /* down */
1505 } 1566 }
1506 if (upordown) 1567 if (upordown)
1507 { 1568 {
1508#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING 1569#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
1509 scroll_arrow_delay = SCROLLBAR_INITIAL_DELAY; 1570 cont_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY);
1510#endif 1571#endif
1511 if (scr_page (upordown < 0 ? UP : DN, 1)) 1572 if (scr_page (upordown < 0 ? UP : DN, 1))
1512 { 1573 {
1513 if (upordown < 0) 1574 if (upordown < 0)
1514 scrollBar.setUp (); 1575 scrollBar.setUp ();
1601 refresh_type &= ~SMOOTH_REFRESH; 1662 refresh_type &= ~SMOOTH_REFRESH;
1602#endif 1663#endif
1603 1664
1604 } 1665 }
1605#ifdef SELECTION_SCROLLING 1666#ifdef SELECTION_SCROLLING
1606 pending_scroll_selection=0; 1667 if (sel_scroll_ev.active)
1668 sel_scroll_ev.stop();
1607#endif 1669#endif
1608 if (ev.window == TermWin.vt) 1670 if (ev.window == TermWin.vt)
1609 { 1671 {
1610 if (reportmode) 1672 if (reportmode)
1611 { 1673 {
1653 case Button5: 1715 case Button5:
1654 { 1716 {
1655 int i; 1717 int i;
1656 page_dirn v; 1718 page_dirn v;
1657 1719
1658 v = (ev.button == Button4) ? UP : DN; 1720 v = ev.button == Button4 ? UP : DN;
1721
1659 if (ev.state & ShiftMask) 1722 if (ev.state & ShiftMask)
1660 i = 1; 1723 i = 1;
1661 else if ((Options & Opt_mouseWheelScrollPage)) 1724 else if (Options & Opt_mouseWheelScrollPage)
1662 i = TermWin.nrow - 1; 1725 i = TermWin.nrow - 1;
1663 else 1726 else
1664 i = 5; 1727 i = 5;
1728
1665# ifdef MOUSE_SLIP_WHEELING 1729# ifdef MOUSE_SLIP_WHEELING
1666 if (ev.state & ControlMask) 1730 if (ev.state & ControlMask)
1667 { 1731 {
1668 mouse_slip_wheel_speed += (v ? -1 : 1); 1732 mouse_slip_wheel_speed += v ? -1 : 1;
1733 if (mouse_slip_wheel_speed < -TermWin.nrow) mouse_slip_wheel_speed = -TermWin.nrow;
1734 if (mouse_slip_wheel_speed > +TermWin.nrow) mouse_slip_wheel_speed = +TermWin.nrow;
1735
1736 if (slip_wheel_ev.at < NOW)
1669 mouse_slip_wheel_delay = SCROLLBAR_CONTINUOUS_DELAY; 1737 slip_wheel_ev.at = NOW + SCROLLBAR_CONTINUOUS_DELAY;
1738
1739 slip_wheel_ev.start ();
1670 } 1740 }
1741 else
1742 {
1671# endif 1743# endif
1672# ifdef JUMP_MOUSE_WHEEL 1744# ifdef JUMP_MOUSE_WHEEL
1673 scr_page (v, i);
1674 scr_refresh (SMOOTH_REFRESH);
1675 scrollbar_show (1);
1676# else
1677 while (i--)
1678 {
1679 scr_page (v, 1); 1745 scr_page (v, i);
1680 scr_refresh (SMOOTH_REFRESH); 1746 scr_refresh (SMOOTH_REFRESH);
1681 scrollbar_show (1); 1747 scrollbar_show (1);
1748# else
1749 while (i--)
1750 {
1751 scr_page (v, 1);
1752 scr_refresh (SMOOTH_REFRESH);
1753 scrollbar_show (1);
1754 }
1755# endif
1756# ifdef MOUSE_SLIP_WHEELING
1682 } 1757 }
1683# endif 1758#endif
1684
1685 } 1759 }
1686 break; 1760 break;
1687#endif 1761#endif
1688
1689 } 1762 }
1690 } 1763 }
1691#ifdef MENUBAR 1764#ifdef MENUBAR
1692 else if (isMenuBarWindow (ev.window)) 1765 else if (isMenuBarWindow (ev.window))
1693 menubar_control (ev); 1766 menubar_control (ev);
1958 if (rootdepth != wattr.depth) 2031 if (rootdepth != wattr.depth)
1959 { 2032 {
1960 if (am_transparent) 2033 if (am_transparent)
1961 { 2034 {
1962 pchanged = 1; 2035 pchanged = 1;
1963 XSetWindowBackground (display->display, TermWin.vt, PixColors[Color_bg]); 2036 XSetWindowBackground (display->display, TermWin.vt, PixColorsFocused[Color_bg]);
1964 am_transparent = am_pixmap_trans = 0; 2037 am_transparent = am_pixmap_trans = 0;
1965 } 2038 }
1966 2039
1967 return pchanged; /* Don't try any more */ 2040 return pchanged; /* Don't try any more */
1968 } 2041 }
1984 i = (xa[XA_XSETROOTID] 2057 i = (xa[XA_XSETROOTID]
1985 && XGetWindowProperty (display->display, display->root, xa[XA_XSETROOTID], 2058 && XGetWindowProperty (display->display, display->root, xa[XA_XSETROOTID],
1986 0L, 1L, False, XA_PIXMAP, &atype, &aformat, 2059 0L, 1L, False, XA_PIXMAP, &atype, &aformat,
1987 &nitems, &bytes_after, &prop) == Success); 2060 &nitems, &bytes_after, &prop) == Success);
1988 2061
1989 if (!i || prop == NULL) 2062 if (!i || prop == NULL || !rs[Rs_color + Color_tint])
1990 have_pixmap = 0; 2063 have_pixmap = 0;
1991 else 2064 else
1992 { 2065 {
1993 have_pixmap = 1; 2066 have_pixmap = 1;
1994 rootpixmap = *(Pixmap *)prop; 2067 rootpixmap = *(Pixmap *)prop;
2005 Window cr; 2078 Window cr;
2006 XImage *image; 2079 XImage *image;
2007 GC gc; 2080 GC gc;
2008 XGCValues gcvalue; 2081 XGCValues gcvalue;
2009 2082
2010 XTranslateCoordinates (display->display, TermWin.parent[0], display->root, 2083 XTranslateCoordinates (display->display, TermWin.vt, display->root,
2011 0, 0, &sx, &sy, &cr); 2084 0, 0, &sx, &sy, &cr);
2012 nw = (unsigned int)szHint.width; 2085 nw = (unsigned int)szHint.width;
2013 nh = (unsigned int)szHint.height; 2086 nh = (unsigned int)szHint.height;
2014 nx = ny = 0; 2087 nx = ny = 0;
2015 2088
2056 XFreePixmap (display->display, TermWin.pixmap); 2129 XFreePixmap (display->display, TermWin.pixmap);
2057 2130
2058#if TINTING 2131#if TINTING
2059 if (ISSET_PIXCOLOR (Color_tint)) 2132 if (ISSET_PIXCOLOR (Color_tint))
2060 { 2133 {
2061 unsigned short shade, rm, gm, bm; 2134 unsigned short rm, gm, bm;
2062 2135 if (rs[Rs_shade])
2136 PixColorsFocused[Color_tint].fade (display, atoi (rs[Rs_shade])).get (display, rm, gm, bm);
2137 else
2063 PixColors[Color_tint].get (display, rm, gm, bm); 2138 PixColorsFocused[Color_tint].get (display, rm, gm, bm);
2064 2139
2065 rm >>= 8; gm >>= 8; bm >>= 8; // not 100% correct, but... 2140 rm >>= 8; gm >>= 8; bm >>= 8; // not 100% correct, but...
2066 2141
2067 /* Determine bitshift and bitmask values */ 2142 /* Determine bitshift and bitmask values */
2068 switch (image->bits_per_pixel) 2143 switch (image->bits_per_pixel)
2080 gc = XCreateGC (display->display, TermWin.vt, 0UL, &gcvalue); 2155 gc = XCreateGC (display->display, TermWin.vt, 0UL, &gcvalue);
2081 XPutImage (display->display, TermWin.pixmap, gc, image, 0, 0, 2156 XPutImage (display->display, TermWin.pixmap, gc, image, 0, 0,
2082 nx, ny, image->width, image->height); 2157 nx, ny, image->width, image->height);
2083 XFreeGC (display->display, gc); 2158 XFreeGC (display->display, gc);
2084 XDestroyImage (image); 2159 XDestroyImage (image);
2085 XSetWindowBackgroundPixmap (display->display, TermWin.vt, 2160 XSetWindowBackgroundPixmap (display->display, TermWin.vt, TermWin.pixmap);
2086 TermWin.pixmap);
2087 2161
2088 if (!am_transparent || !am_pixmap_trans) 2162 if (!am_transparent || !am_pixmap_trans)
2089 pchanged = 1; 2163 pchanged = 1;
2090 2164
2091 am_transparent = am_pixmap_trans = 1; 2165 am_transparent = am_pixmap_trans = 1;
2135 } 2209 }
2136 } 2210 }
2137 2211
2138 if (n > (int) (sizeof (TermWin.parent) / sizeof (TermWin.parent[0]))) 2212 if (n > (int) (sizeof (TermWin.parent) / sizeof (TermWin.parent[0])))
2139 { 2213 {
2140 D_X ((stderr, "InheritPixmap Turning off")); 2214 D_X ((stderr, "InheritPixmap Turning off")); /* Mikachu? */
2141 XSetWindowBackground (display->display, TermWin.parent[0], PixColors[Color_fg]); 2215 XSetWindowBackground (display->display, TermWin.parent[0], PixColorsFocused[Color_fg]);
2142 XSetWindowBackground (display->display, TermWin.vt, PixColors[Color_bg]); 2216 XSetWindowBackground (display->display, TermWin.vt, PixColorsFocused[Color_bg]);
2143 am_transparent = 0; 2217 am_transparent = 0;
2144 /* XXX: also turn off Opt_transparent? */ 2218 /* XXX: also turn off Opt_transparent? */
2145 } 2219 }
2146 else 2220 else
2147 { 2221 {
2274 } 2348 }
2275 2349
2276 return flag; 2350 return flag;
2277} 2351}
2278 2352
2353// read the next octet
2354unicode_t
2355rxvt_term::next_octet ()
2356{
2357 return cmdbuf_ptr < cmdbuf_endp
2358 ? *cmdbuf_ptr++
2359 : NOCHAR;
2360}
2361
2279// read the next character 2362// read the next character
2280unicode_t 2363unicode_t
2281rxvt_term::next_char () 2364rxvt_term::next_char ()
2282{ 2365{
2283 while (cmdbuf_ptr < cmdbuf_endp) 2366 while (cmdbuf_ptr < cmdbuf_endp)
2314 */ 2397 */
2315unicode_t 2398unicode_t
2316rxvt_term::cmd_getc () 2399rxvt_term::cmd_getc ()
2317{ 2400{
2318 unicode_t c = next_char (); 2401 unicode_t c = next_char ();
2402
2403 if (c == NOCHAR)
2404 throw out_of_input;
2405
2406 return c;
2407}
2408
2409unicode_t
2410rxvt_term::cmd_get8 ()
2411{
2412 unicode_t c = next_octet ();
2319 2413
2320 if (c == NOCHAR) 2414 if (c == NOCHAR)
2321 throw out_of_input; 2415 throw out_of_input;
2322 2416
2323 return c; 2417 return c;
2453 break; 2547 break;
2454 case C0_SI: /* shift in - acs */ 2548 case C0_SI: /* shift in - acs */
2455 scr_charset_choose (0); 2549 scr_charset_choose (0);
2456 break; 2550 break;
2457 2551
2552#ifdef EIGHT_BIT_CONTROLS
2458 // 8-bit controls 2553 // 8-bit controls
2459 case 0x90: /* DCS */ 2554 case 0x90: /* DCS */
2460 process_dcs_seq (); 2555 process_dcs_seq ();
2461 break; 2556 break;
2462 case 0x9b: /* CSI */ 2557 case 0x9b: /* CSI */
2463 process_csi_seq (); 2558 process_csi_seq ();
2464 break; 2559 break;
2465 case 0x9d: /* CSI */ 2560 case 0x9d: /* CSI */
2466 process_osc_seq (); 2561 process_osc_seq ();
2467 break; 2562 break;
2563#endif
2468 } 2564 }
2469} 2565}
2470/*}}} */ 2566/*}}} */
2471 2567
2472 2568
2661 2757
2662/*{{{ process CONTROL SEQUENCE INTRODUCER (CSI) sequences `ESC[' */ 2758/*{{{ process CONTROL SEQUENCE INTRODUCER (CSI) sequences `ESC[' */
2663/* *INDENT-OFF* */ 2759/* *INDENT-OFF* */
2664enum { 2760enum {
2665 CSI_ICH = 0x40, 2761 CSI_ICH = 0x40,
2666 CSI_CUU, CSI_CUD, CSI_CUF, CSI_CUB, CSI_CNL, CSI_CPL, CSI_CHA, 2762 CSI_CUU, CSI_CUD, CSI_CUF, CSI_CUB, CSI_CNL, CSI_CPL, CSI_CHA,
2667 CSI_CUP, CSI_CHT, CSI_ED , CSI_EL , CSI_IL , CSI_DL , CSI_EF , CSI_EA , 2763 CSI_CUP, CSI_CHT, CSI_ED , CSI_EL , CSI_IL , CSI_DL , CSI_EF , CSI_EA ,
2668 CSI_DCH, CSI_SEE, CSI_CPR, CSI_SU , CSI_SD , CSI_NP , CSI_PP , CSI_CTC, 2764 CSI_DCH, CSI_SEE, CSI_CPR, CSI_SU , CSI_SD , CSI_NP , CSI_PP , CSI_CTC,
2669 CSI_ECH, CSI_CVT, CSI_CBT, CSI_SRS, CSI_PTX, CSI_SDS, CSI_SIMD, CSI_5F, 2765 CSI_ECH, CSI_CVT, CSI_CBT, CSI_SRS, CSI_PTX, CSI_SDS, CSI_SIMD, CSI_5F,
2670 CSI_HPA, CSI_HPR, CSI_REP, CSI_DA , CSI_VPA, CSI_VPR, CSI_HVP, CSI_TBC, 2766 CSI_HPA, CSI_HPR, CSI_REP, CSI_DA , CSI_VPA, CSI_VPR, CSI_HVP, CSI_TBC,
2671 CSI_SM , CSI_MC , CSI_HPB, CSI_VPB, CSI_RM , CSI_SGR, CSI_DSR, CSI_DAQ, 2767 CSI_SM , CSI_MC , CSI_HPB, CSI_VPB, CSI_RM , CSI_SGR, CSI_DSR, CSI_DAQ,
3090 * ends_how is terminator used. returned input must be free()'d 3186 * ends_how is terminator used. returned input must be free()'d
3091 */ 3187 */
3092unsigned char * 3188unsigned char *
3093rxvt_term::get_to_st (unicode_t &ends_how) 3189rxvt_term::get_to_st (unicode_t &ends_how)
3094{ 3190{
3095 int seen_esc = 0; /* seen escape? */ 3191 unicode_t prev = 0, ch;
3096 unsigned int n = 0; 3192 unsigned int n = 0;
3097 unsigned char *s; 3193 unsigned char *s;
3098 unicode_t ch;
3099 unsigned char string[STRING_MAX]; 3194 unsigned char string[STRING_MAX];
3100 3195
3101 while ((ch = cmd_getc ())) 3196 while ((ch = cmd_getc ()) != NOCHAR)
3102 { 3197 {
3103 if (ch == C0_BEL || ch == CHAR_ST) 3198 if (prev == C0_ESC)
3104 break; 3199 {
3105
3106 if (seen_esc)
3107 if (ch == 0x5c) /* 7bit ST */ 3200 if (ch == 0x5c) /* 7bit ST */
3108 break; 3201 break;
3109 else 3202 else
3110 return NULL; 3203 return NULL;
3111
3112 if (ch == C0_ESC)
3113 { 3204 }
3114 seen_esc = 1; 3205 else if (ch == C0_BEL || ch == CHAR_ST)
3115 continue; 3206 break;
3116 }
3117 else if (ch == C0_HT) 3207 else if (ch < 0x20)
3118 ch = ' '; /* translate '\t' to space */
3119 else if (ch < 0x20 && (ch != C0_LF && ch != C0_CR))
3120 return NULL; /* other control character - exit */ 3208 return NULL; /* other control character - exit */
3121 3209
3122 if (n >= sizeof (string) - 1) 3210 if (n >= sizeof (string) - 1)
3123 // stop at some sane length 3211 // stop at some sane length
3124 return NULL; 3212 return NULL;
3125 3213
3214 if (ch == C0_SYN)
3215 {
3216 string[n++] = cmd_get8 ();
3217 prev = 0;
3218 }
3219 else
3126 string[n++] = ch; 3220 string[n++] = prev = ch;
3127 seen_esc = 0;
3128 } 3221 }
3129 3222
3130 string[n++] = '\0'; 3223 string[n++] = '\0';
3131 3224
3132 if ((s = (unsigned char *)rxvt_malloc (n)) == NULL) 3225 if ((s = (unsigned char *)rxvt_malloc (n)) == NULL)
3189 if (str[0] == '?' && !str[1]) 3282 if (str[0] == '?' && !str[1])
3190 { 3283 {
3191 if (Options & Opt_insecure) 3284 if (Options & Opt_insecure)
3192 { 3285 {
3193 unsigned short r, g, b; 3286 unsigned short r, g, b;
3194 PixColors[color].get (display, r, g, b); 3287 PixColorsFocused[color].get (display, r, g, b);
3195 tt_printf ("\033]%d;rgb:%04x/%04x/%04x%c", report, r, g, b, resp); 3288 tt_printf ("\033]%d;rgb:%04x/%04x/%04x%c", report, r, g, b, resp);
3196 } 3289 }
3197 } 3290 }
3198 else 3291 else
3199 set_window_color (color, str); 3292 set_window_color (color, str);
3304 if (name[0] == '?' && !name[1]) 3397 if (name[0] == '?' && !name[1])
3305 { 3398 {
3306 if (Options & Opt_insecure) 3399 if (Options & Opt_insecure)
3307 { 3400 {
3308 unsigned short r, g, b; 3401 unsigned short r, g, b;
3309 PixColors[color + minCOLOR].get (display, r, g, b); 3402 PixColorsFocused[color + minCOLOR].get (display, r, g, b);
3310 tt_printf ("\033]%d;%d;rgb:%04x/%04x/%04x%c", XTerm_Color, color, r, g, b, resp); 3403 tt_printf ("\033]%d;%d;rgb:%04x/%04x/%04x%c", XTerm_Color, color, r, g, b, resp);
3311 } 3404 }
3312 } 3405 }
3313 else 3406 else
3314 set_window_color (color + minCOLOR, name); 3407 set_window_color (color + minCOLOR, name);
3687 rendset = 0, rendstyle = ~RS_None; 3780 rendset = 0, rendstyle = ~RS_None;
3688 break; 3781 break;
3689 case 1: 3782 case 1:
3690 rendset = 1, rendstyle = RS_Bold; 3783 rendset = 1, rendstyle = RS_Bold;
3691 break; 3784 break;
3785 //case 2: // faint or second colour
3692 case 4: 3786 case 4:
3693 rendset = 1, rendstyle = RS_Uline; 3787 rendset = 1, rendstyle = RS_Uline;
3694 break; 3788 break;
3695 case 5: 3789 case 5: // slowly blinking
3790 case 6: // rapidly blinking
3696 rendset = 1, rendstyle = RS_Blink; 3791 rendset = 1, rendstyle = RS_Blink;
3697 break; 3792 break;
3698 //case 6: // scoansi light background 3793 //case 6: // scoansi light background
3699 case 7: 3794 case 7:
3700 rendset = 1, rendstyle = RS_RVid; 3795 rendset = 1, rendstyle = RS_RVid;
3701 break; 3796 break;
3702 case 8: 3797 case 8:
3703 // invisible. NYI 3798 // invisible. NYI
3704 break; 3799 break;
3800 //case 9: // crossed out
3705 //case 10: // scoansi acs off 3801 //case 10: // scoansi acs off, primary font
3706 //case 11: // scoansi acs on 3802 //case 11: // scoansi acs on, first alt font
3707 //case 12: // scoansi acs on, |0x80 3803 //case 12: // scoansi acs on, |0x80, second alt font
3708 case 21: // disable bold, blink and invis (some terminals use this) 3804 //...
3805 //case 19: // ninth alt font
3806 //case 20: // gothic
3807 case 21: // disable bold, faint
3709 rendset = 0, rendstyle = RS_Bold | RS_Blink; 3808 rendset = 0, rendstyle = RS_Bold;
3710 break; 3809 break;
3711 case 22: 3810 case 22:
3712 rendset = 0, rendstyle = RS_Bold; 3811 rendset = 0, rendstyle = RS_Bold;
3713 break; 3812 break;
3813 //case 23: disable italic
3714 case 24: 3814 case 24:
3715 rendset = 0, rendstyle = RS_Uline; 3815 rendset = 0, rendstyle = RS_Uline;
3716 break; 3816 break;
3717 case 25: 3817 case 25:
3718 rendset = 0, rendstyle = RS_Blink; 3818 rendset = 0, rendstyle = RS_Blink;
3719 break; 3819 break;
3720 case 27: 3820 case 27:
3721 rendset = 0, rendstyle = RS_RVid; 3821 rendset = 0, rendstyle = RS_RVid;
3722 break; 3822 break;
3723 case 28:
3724 // visible. NYI 3823 //case 28: // visible. NYI
3725 break; 3824 //case 29: // not crossed-out
3726 } 3825 }
3727 3826
3728 if (rendset != -1) 3827 if (rendset != -1)
3729 { 3828 {
3730 scr_rendition (rendset, rendstyle); 3829 scr_rendition (rendset, rendstyle);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines