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.220 by root, Sat Dec 31 18:19:06 2005 UTC vs.
Revision 1.235 by root, Wed Jan 4 20:43:37 2006 UTC

43 * along with this program; if not, write to the Free Software 43 * along with this program; if not, write to the Free Software
44 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 44 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
45 *----------------------------------------------------------------------*/ 45 *----------------------------------------------------------------------*/
46 46
47/*{{{ includes: */ 47/*{{{ includes: */
48#include "../config.h" /* NECESSARY */ 48#include "../config.h"
49#include "rxvt.h" /* NECESSARY */ 49#include "rxvt.h"
50#include "rxvtperl.h"
50#include "version.h" 51#include "version.h"
51#include "command.h" 52#include "command.h"
53
54#if HAVE_SCHED_YIELD
55#undef HAVE_SCHED_YIELD // disabled for the time being
56//# include <sched.h>
57#endif
52 58
53#ifdef KEYSYM_RESOURCE 59#ifdef KEYSYM_RESOURCE
54# include "keyboard.h" 60# include "keyboard.h"
55#endif 61#endif
56 62
262 mb[0] = ch[0]; 268 mb[0] = ch[0];
263 len = 1; 269 len = 1;
264 } 270 }
265 271
266 if (len > 0) 272 if (len > 0)
267 tt_write ((unsigned char *)mb, len); 273 tt_write (mb, len);
268 else 274 else
269 scr_bell (); 275 scr_bell ();
270 } 276 }
271 277
272 iso14755buf = 0; 278 iso14755buf = 0;
300 KeySym keysym; 306 KeySym keysym;
301#ifdef DEBUG_CMD 307#ifdef DEBUG_CMD
302 static int debug_key = 1; /* accessible by a debugger only */ 308 static int debug_key = 1; /* accessible by a debugger only */
303#endif 309#endif
304 int valid_keysym; 310 int valid_keysym;
305 unsigned char kbuf[KBUFSZ]; 311 char kbuf[KBUFSZ];
306 312
307 /* 313 /*
308 * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an 314 * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an
309 * escape sequence to toggle the Keypad. 315 * escape sequence to toggle the Keypad.
310 * 316 *
328 Status status_return; 334 Status status_return;
329 335
330#if 0 336#if 0
331#ifdef X_HAVE_UTF8_STRING 337#ifdef X_HAVE_UTF8_STRING
332 if (enc_utf8 && 0) // currently disabled, doesn't seem to work, nor is useful 338 if (enc_utf8 && 0) // currently disabled, doesn't seem to work, nor is useful
333 len = Xutf8LookupString (Input_Context, &ev, (char *)kbuf, 339 len = Xutf8LookupString (Input_Context, &ev, kbuf,
334 KBUFSZ, &keysym, &status_return); 340 KBUFSZ, &keysym, &status_return);
335 else 341 else
336#endif 342#endif
337#endif 343#endif
338 { 344 {
375 || status_return == XLookupBoth; 381 || status_return == XLookupBoth;
376 } 382 }
377 else 383 else
378#endif 384#endif
379 { 385 {
380 len = XLookupString (&ev, (char *)kbuf, KBUFSZ, &keysym, &compose); 386 len = XLookupString (&ev, kbuf, KBUFSZ, &keysym, &compose);
381 valid_keysym = keysym != NoSymbol; 387 valid_keysym = keysym != NoSymbol;
382 } 388 }
383 389
384 if (valid_keysym) 390 if (valid_keysym)
385 { 391 {
849 { 855 {
850#ifdef META8_OPTION 856#ifdef META8_OPTION
851 /* set 8-bit on */ 857 /* set 8-bit on */
852 if (meta && (meta_char == 0x80)) 858 if (meta && (meta_char == 0x80))
853 { 859 {
854 unsigned char *ch; 860 char *ch;
855 861
856 for (ch = kbuf; ch < kbuf + len; ch++) 862 for (ch = kbuf; ch < kbuf + len; ch++)
857 *ch |= 0x80; 863 *ch |= 0x80;
858 864
859 meta = 0; 865 meta = 0;
892#ifdef META8_OPTION 898#ifdef META8_OPTION
893 && meta_char == C0_ESC 899 && meta_char == C0_ESC
894#endif 900#endif
895 ) 901 )
896 { 902 {
897 const unsigned char ch = C0_ESC; 903 const char ch = C0_ESC;
898 tt_write (&ch, 1); 904 tt_write (&ch, 1);
899 } 905 }
900 906
901#if defined(DEBUG_CMD) 907#if defined(DEBUG_CMD)
902 /* Display keyboard buffer contents */ 908 /* Display keyboard buffer contents */
914 920
915#if MENUBAR_MAX || defined (KEYSYM_RESOURCE) 921#if MENUBAR_MAX || defined (KEYSYM_RESOURCE)
916/*{{{ rxvt_cmd_write (), rxvt_cmd_getc () */ 922/*{{{ rxvt_cmd_write (), rxvt_cmd_getc () */
917/* attempt to `write' count to the input buffer */ 923/* attempt to `write' count to the input buffer */
918unsigned int 924unsigned int
919rxvt_term::cmd_write (const unsigned char *str, unsigned int count) 925rxvt_term::cmd_write (const char *str, unsigned int count)
920{ 926{
921 unsigned int n, s; 927 unsigned int n, s;
922 928
923 n = cmdbuf_ptr - cmdbuf_base; 929 n = cmdbuf_ptr - cmdbuf_base;
924 s = cmdbuf_base + CBUFSIZ - 1 - cmdbuf_endp; 930 s = cmdbuf_base + CBUFSIZ - 1 - cmdbuf_endp;
980 SET_LOCALE (locale); 986 SET_LOCALE (locale);
981 987
982 display->flush (); 988 display->flush ();
983 989
984 if (want_refresh && !flush_ev.active) 990 if (want_refresh && !flush_ev.active)
985 flush_ev.start (NOW + 0.01); 991 flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally
986} 992}
987 993
988void 994void
989rxvt_term::flush_cb (time_watcher &w) 995rxvt_term::flush_cb (time_watcher &w)
990{ 996{
1065 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); 1071 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY);
1066 } 1072 }
1067} 1073}
1068#endif 1074#endif
1069 1075
1076#if HAVE_SCHED_YIELD
1077static struct event_handler
1078{
1079 check_watcher cw_yield;
1080
1081 void yield (check_watcher &w)
1082 {
1083 sched_yield ();
1084 w.stop ();
1085 }
1086
1087 event_handler ()
1088 : cw_yield (this, &event_handler::yield)
1089 {
1090 }
1091} event_handler;
1092#endif
1093
1070bool 1094bool
1071rxvt_term::pty_fill () 1095rxvt_term::pty_fill ()
1072{ 1096{
1073 ssize_t n = cmdbuf_endp - cmdbuf_ptr; 1097 ssize_t n = cmdbuf_endp - cmdbuf_ptr;
1074 1098
1075 if (CBUFSIZ == n) 1099 if (CBUFSIZ == n)
1076 { 1100 {
1077 rxvt_warn ("pty_fill on full buffer, draining input, continuing.\n"); 1101 rxvt_warn ("PLEASE REPORT: pty_fill on full buffer, draining input, continuing.\n");
1078 n = 0; 1102 n = 0;
1079 } 1103 }
1080 1104
1081 memmove (cmdbuf_base, cmdbuf_ptr, n); 1105 memmove (cmdbuf_base, cmdbuf_ptr, n);
1082 cmdbuf_ptr = cmdbuf_base; 1106 cmdbuf_ptr = cmdbuf_base;
1083 cmdbuf_endp = cmdbuf_ptr + n; 1107 cmdbuf_endp = cmdbuf_ptr + n;
1084 1108
1085 n = read (pty.pty, cmdbuf_endp, CBUFSIZ - n); 1109 ssize_t r = read (pty.pty, cmdbuf_endp, CBUFSIZ - n);
1086 1110
1087 if (n > 0) 1111 if (r > 0)
1088 { 1112 {
1089 cmdbuf_endp += n; 1113 cmdbuf_endp += r;
1090 return true; 1114 return true;
1091 } 1115 }
1092 else if ((n < 0 && errno != EAGAIN && errno != EINTR) || n == 0) 1116 else if (r < 0 && (errno == EAGAIN || errno == EINTR))
1117 {
1118#if HAVE_SCHED_YIELD
1119 if (display->is_local)
1120 event_handler.cw_yield.start ();
1121#endif
1122 }
1123 else
1093 { 1124 {
1094 pty_ev.stop (); 1125 pty_ev.stop ();
1095 1126
1096 if (!OPTION (Opt_hold)) 1127 if (!OPTION (Opt_hold))
1097 destroy (); 1128 destroy ();
1670{ 1701{
1671 if (!focus) 1702 if (!focus)
1672 { 1703 {
1673 focus = 1; 1704 focus = 1;
1674 want_refresh = 1; 1705 want_refresh = 1;
1706
1707 PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END));
1708
1675#if USE_XIM 1709#if USE_XIM
1676 if (Input_Context != NULL) 1710 if (Input_Context != NULL)
1677 { 1711 {
1678 IMSetStatusPosition (); 1712 IMSetStatusPosition ();
1679 XSetICFocus (Input_Context); 1713 XSetICFocus (Input_Context);
1699 if (focus) 1733 if (focus)
1700 { 1734 {
1701 focus = 0; 1735 focus = 0;
1702 want_refresh = 1; 1736 want_refresh = 1;
1703 1737
1738 PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END));
1739
1704#if ENABLE_FRILLS || ISO_14755 1740#if ENABLE_FRILLS || ISO_14755
1741 if (iso14755buf)
1742 {
1705 iso14755buf = 0; 1743 iso14755buf = 0;
1706#endif
1707#if ENABLE_OVERLAY 1744# if ENABLE_OVERLAY
1708 scr_overlay_off (); 1745 scr_overlay_off ();
1746# endif
1747 }
1709#endif 1748#endif
1710#if USE_XIM 1749#if USE_XIM
1711 if (Input_Context != NULL) 1750 if (Input_Context != NULL)
1712 XUnsetICFocus (Input_Context); 1751 XUnsetICFocus (Input_Context);
1713#endif 1752#endif
1757rxvt_term::button_press (XButtonEvent &ev) 1796rxvt_term::button_press (XButtonEvent &ev)
1758{ 1797{
1759 int reportmode = 0, clickintime; 1798 int reportmode = 0, clickintime;
1760 1799
1761 bypass_keystate = ev.state & (ModMetaMask | ShiftMask); 1800 bypass_keystate = ev.state & (ModMetaMask | ShiftMask);
1801
1762 if (!bypass_keystate) 1802 if (!bypass_keystate)
1763 reportmode = !! (priv_modes & PrivMode_mouse_report); 1803 reportmode = !! (priv_modes & PrivMode_mouse_report);
1764 1804
1765 /* 1805 /*
1766 * VT window processing of button press 1806 * VT window processing of button press
1815 else 1855 else
1816 { 1856 {
1817 if (ev.button != MEvent.button) 1857 if (ev.button != MEvent.button)
1818 MEvent.clicks = 0; 1858 MEvent.clicks = 0;
1819 1859
1860 if (!PERL_INVOKE ((this, HOOK_MOUSE_CLICK, DT_XEVENT, &ev, DT_END)))
1820 switch (ev.button) 1861 switch (ev.button)
1821 { 1862 {
1822 case Button1: 1863 case Button1:
1823 /* allow meta + click to select rectangular areas */ 1864 /* allow meta + click to select rectangular areas */
1824 /* should be done in screen.C */ 1865 /* should be done in screen.C */
1825#if ENABLE_FRILLS 1866#if ENABLE_FRILLS
1826 selection.rect = !!(ev.state & ModMetaMask); 1867 selection.rect = !!(ev.state & ModMetaMask);
1827#else 1868#else
1828 selection.rect = false; 1869 selection.rect = false;
1829#endif 1870#endif
1830 1871
1831 /* allow shift+left click to extend selection */ 1872 /* allow shift+left click to extend selection */
1832 if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report)) 1873 if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report))
1833 { 1874 {
1834 if (MEvent.button == Button1 && clickintime) 1875 if (MEvent.button == Button1 && clickintime)
1835 selection_rotate (ev.x, ev.y); 1876 selection_rotate (ev.x, ev.y);
1836 else 1877 else
1837 selection_extend (ev.x, ev.y, 1); 1878 selection_extend (ev.x, ev.y, 1);
1838 } 1879 }
1839 else 1880 else
1840 { 1881 {
1841 if (MEvent.button == Button1 && clickintime) 1882 if (MEvent.button == Button1 && clickintime)
1842 MEvent.clicks++; 1883 MEvent.clicks++;
1843 else 1884 else
1844 MEvent.clicks = 1; 1885 MEvent.clicks = 1;
1845 1886
1846 selection_click (MEvent.clicks, ev.x, ev.y); 1887 selection_click (MEvent.clicks, ev.x, ev.y);
1847 } 1888 }
1848 1889
1849 MEvent.button = Button1; 1890 MEvent.button = Button1;
1850 break; 1891 break;
1851 1892
1852 case Button3: 1893 case Button3:
1853 if (MEvent.button == Button3 && clickintime) 1894 if (MEvent.button == Button3 && clickintime)
1854 selection_rotate (ev.x, ev.y); 1895 selection_rotate (ev.x, ev.y);
1855 else 1896 else
1856 selection_extend (ev.x, ev.y, 1); 1897 selection_extend (ev.x, ev.y, 1);
1857 1898
1858 MEvent.button = Button3; 1899 MEvent.button = Button3;
1859 break; 1900 break;
1860 } 1901 }
1861 } 1902 }
1862 1903
1863 MEvent.time = ev.time; 1904 MEvent.time = ev.time;
1864 return; 1905 return;
1865 } 1906 }
1866 1907
2630bool 2671bool
2631rxvt_term::cmd_parse () 2672rxvt_term::cmd_parse ()
2632{ 2673{
2633 bool flag = false; 2674 bool flag = false;
2634 unicode_t ch = NOCHAR; 2675 unicode_t ch = NOCHAR;
2635 unsigned char *seq_begin; // remember start of esc-sequence here 2676 char *seq_begin; // remember start of esc-sequence here
2636 2677
2637 for (;;) 2678 for (;;)
2638 { 2679 {
2639 if (ch == NOCHAR) 2680 if (ch == NOCHAR)
2640 { 2681 {
2684 2725
2685 if (!OPTION (Opt_jumpScroll) 2726 if (!OPTION (Opt_jumpScroll)
2686 || (refresh_count >= refresh_limit * (nrow - 1))) 2727 || (refresh_count >= refresh_limit * (nrow - 1)))
2687 { 2728 {
2688 refreshnow = true; 2729 refreshnow = true;
2730 refresh_count = 0;
2689 ch = NOCHAR; 2731 ch = NOCHAR;
2690 break; 2732 break;
2691 } 2733 }
2692 2734
2693 // scr_add_lines only works for nlines <= nrow - 1. 2735 // scr_add_lines only works for nlines <= nrow - 1.
2730 refresh_limit++; 2772 refresh_limit++;
2731 else 2773 else
2732 { 2774 {
2733 flag = true; 2775 flag = true;
2734 scr_refresh (refresh_type); 2776 scr_refresh (refresh_type);
2777 flush_ev.stop ();
2735 } 2778 }
2736 } 2779 }
2737 2780
2738 } 2781 }
2739 else 2782 else
2770rxvt_term::next_char () 2813rxvt_term::next_char ()
2771{ 2814{
2772 while (cmdbuf_ptr < cmdbuf_endp) 2815 while (cmdbuf_ptr < cmdbuf_endp)
2773 { 2816 {
2774 // assume 7-bit to be ascii ALWAYS 2817 // assume 7-bit to be ascii ALWAYS
2775 if (*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) 2818 if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b)
2776 return *cmdbuf_ptr++; 2819 return *cmdbuf_ptr++;
2777 2820
2778 wchar_t wc; 2821 wchar_t wc;
2779 size_t len = mbrtowc (&wc, (char *)cmdbuf_ptr, cmdbuf_endp - cmdbuf_ptr, mbstate); 2822 size_t len = mbrtowc (&wc, cmdbuf_ptr, cmdbuf_endp - cmdbuf_ptr, mbstate);
2780 2823
2781 if (len == (size_t)-2) 2824 if (len == (size_t)-2)
2782 { 2825 {
2783 // the mbstate stores incomplete sequences. didn't know this :/ 2826 // the mbstate stores incomplete sequences. didn't know this :/
2784 cmdbuf_ptr = cmdbuf_endp; 2827 cmdbuf_ptr = cmdbuf_endp;
2923 case C0_ESC: 2966 case C0_ESC:
2924 process_escape_seq (); 2967 process_escape_seq ();
2925 break; 2968 break;
2926 case C0_ENQ: /* terminal Status */ 2969 case C0_ENQ: /* terminal Status */
2927 if (rs[Rs_answerbackstring]) 2970 if (rs[Rs_answerbackstring])
2928 tt_write ((const unsigned char *)rs[Rs_answerbackstring], 2971 tt_write (rs [Rs_answerbackstring], strlen (rs [Rs_answerbackstring]));
2929 (unsigned int)strlen (rs[Rs_answerbackstring]));
2930 else 2972 else
2931 tt_write ((unsigned char *)VT100_ANS, 2973 tt_write (VT100_ANS, strlen (VT100_ANS));
2932 (unsigned int)strlen (VT100_ANS));
2933 break; 2974 break;
2934 case C0_BEL: /* bell */ 2975 case C0_BEL: /* bell */
2935 scr_bell (); 2976 scr_bell ();
2936 break; 2977 break;
2937 case C0_BS: /* backspace */ 2978 case C0_BS: /* backspace */
3125 process_dcs_seq (); 3166 process_dcs_seq ();
3126 break; 3167 break;
3127 3168
3128 /* 8.3.110: SINGLE CHARACTER INTRODUCER */ 3169 /* 8.3.110: SINGLE CHARACTER INTRODUCER */
3129 case C1_SCI: /* ESC Z */ 3170 case C1_SCI: /* ESC Z */
3130 tt_write ((const unsigned char *)ESCZ_ANSWER, 3171 tt_write (ESCZ_ANSWER, sizeof (ESCZ_ANSWER) - 1);
3131 (unsigned int) (sizeof (ESCZ_ANSWER) - 1));
3132 break; /* steal obsolete ESC [ c */ 3172 break; /* steal obsolete ESC [ c */
3133 3173
3134 /* 8.3.16: CONTROL SEQUENCE INTRODUCER */ 3174 /* 8.3.16: CONTROL SEQUENCE INTRODUCER */
3135 case C1_CSI: /* ESC [ */ 3175 case C1_CSI: /* ESC [ */
3136 process_csi_seq (); 3176 process_csi_seq ();
3380 case CSI_SU: /* 8.3.148: (1) SCROLL UP */ 3420 case CSI_SU: /* 8.3.148: (1) SCROLL UP */
3381 scr_scroll_text (screen.tscroll, screen.bscroll, arg[0]); 3421 scr_scroll_text (screen.tscroll, screen.bscroll, arg[0]);
3382 break; 3422 break;
3383 3423
3384 case CSI_DA: /* 8.3.24: (0) DEVICE ATTRIBUTES */ 3424 case CSI_DA: /* 8.3.24: (0) DEVICE ATTRIBUTES */
3385 tt_write ((const unsigned char *)VT100_ANS, 3425 tt_write (VT100_ANS, sizeof (VT100_ANS) - 1);
3386 (unsigned int) (sizeof (VT100_ANS) - 1));
3387 break; 3426 break;
3388 3427
3389 case CSI_SGR: /* 8.3.118: (0) SELECT GRAPHIC RENDITION */ 3428 case CSI_SGR: /* 8.3.118: (0) SELECT GRAPHIC RENDITION */
3390 process_sgr_mode (nargs, arg); 3429 process_sgr_mode (nargs, arg);
3391 break; 3430 break;
3593/*----------------------------------------------------------------------*/ 3632/*----------------------------------------------------------------------*/
3594/* 3633/*
3595 * get input up until STRING TERMINATOR (or BEL) 3634 * get input up until STRING TERMINATOR (or BEL)
3596 * ends_how is terminator used. returned input must be free()'d 3635 * ends_how is terminator used. returned input must be free()'d
3597 */ 3636 */
3598unsigned char * 3637char *
3599rxvt_term::get_to_st (unicode_t &ends_how) 3638rxvt_term::get_to_st (unicode_t &ends_how)
3600{ 3639{
3601 unicode_t ch; 3640 unicode_t ch;
3602 bool seen_esc = false; 3641 bool seen_esc = false;
3603 unsigned int n = 0; 3642 unsigned int n = 0;
3636 3675
3637 string[n++] = '\0'; 3676 string[n++] = '\0';
3638 3677
3639 ends_how = (ch == 0x5c ? C0_ESC : ch); 3678 ends_how = (ch == 0x5c ? C0_ESC : ch);
3640 3679
3641 return (unsigned char *)rxvt_wcstombs (string); 3680 return rxvt_wcstombs (string);
3642} 3681}
3643 3682
3644/*----------------------------------------------------------------------*/ 3683/*----------------------------------------------------------------------*/
3645/* 3684/*
3646 * process DEVICE CONTROL STRING `ESC P ... (ST|BEL)' or `0x90 ... (ST|BEL)' 3685 * process DEVICE CONTROL STRING `ESC P ... (ST|BEL)' or `0x90 ... (ST|BEL)'
3647 */ 3686 */
3648void 3687void
3649rxvt_term::process_dcs_seq () 3688rxvt_term::process_dcs_seq ()
3650{ 3689{
3651 unsigned char *s; 3690 char *s;
3652 unicode_t eh; 3691 unicode_t eh;
3653 3692
3654 /* 3693 /*
3655 * Not handled yet 3694 * Not handled yet
3656 */ 3695 */
3675 for (arg = 0; isdigit (ch); ch = cmd_getc ()) 3714 for (arg = 0; isdigit (ch); ch = cmd_getc ())
3676 arg = arg * 10 + (ch - '0'); 3715 arg = arg * 10 + (ch - '0');
3677 3716
3678 if (ch == ';') 3717 if (ch == ';')
3679 { 3718 {
3680 unsigned char *s = get_to_st (eh); 3719 char *s = get_to_st (eh);
3681 3720
3682 if (s) 3721 if (s)
3683 { 3722 {
3684 process_xterm_seq (arg, (char *)s, eh); 3723 process_xterm_seq (arg, s, eh);
3685 free (s); 3724 free (s);
3686 } 3725 }
3687 } 3726 }
3688} 3727}
3689 3728
3690void 3729void
3691rxvt_term::process_color_seq (int report, int color, const char *str, unsigned char resp) 3730rxvt_term::process_color_seq (int report, int color, const char *str, char resp)
3692{ 3731{
3693 if (str[0] == '?' && !str[1]) 3732 if (str[0] == '?' && !str[1])
3694 { 3733 {
3695 unsigned short r, g, b; 3734 unsigned short r, g, b;
3696 pix_colors_focused[color].get (display, r, g, b); 3735 pix_colors_focused[color].get (display, r, g, b);
3702 3741
3703/* 3742/*
3704 * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) 3743 * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL)
3705 */ 3744 */
3706void 3745void
3707rxvt_term::process_xterm_seq (int op, const char *str, unsigned char resp) 3746rxvt_term::process_xterm_seq (int op, const char *str, char resp)
3708{ 3747{
3709 int changed = 0; 3748 int changed = 0;
3710 int color; 3749 int color;
3711 char *buf, *name; 3750 char *buf, *name;
3712 bool query = str[0] == '?' && !str[1]; 3751 bool query = str[0] == '?' && !str[1];
3919 } 3958 }
3920 break; 3959 break;
3921 3960
3922 case URxvt_view_up: 3961 case URxvt_view_up:
3923 case URxvt_view_down: 3962 case URxvt_view_down:
3963 {
3924 int lines = atoi (str); 3964 int lines = atoi (str);
3925 3965
3926 if (lines) 3966 if (lines)
3927 scr_page (op == URxvt_view_up ? UP : DN, lines); 3967 scr_page (op == URxvt_view_up ? UP : DN, lines);
3928 else 3968 else
3929 {
3930 scr_erase_savelines (); 3969 scr_erase_savelines ();
3931 } 3970 }
3932 3971
3972 break;
3973#endif
3974
3975#if ENABLE_PERL
3976 case URxvt_perl:
3977 if (PERL_INVOKE ((this, HOOK_OSC_SEQ, DT_STRING, str, DT_END)))
3978 ; // no responses yet
3933 break; 3979 break;
3934#endif 3980#endif
3935 } 3981 }
3936} 3982}
3937/*----------------------------------------------------------------------*/ 3983/*----------------------------------------------------------------------*/
4052 case 1021: 4098 case 1021:
4053 if (mode) 4099 if (mode)
4054 SET_OPTION (Opt_intensityStyles); 4100 SET_OPTION (Opt_intensityStyles);
4055 else 4101 else
4056 CLR_OPTION (Opt_intensityStyles); 4102 CLR_OPTION (Opt_intensityStyles);
4103
4104 scr_touch (true);
4105 break;
4057#endif 4106#endif
4058 case 1048: /* alternative cursor save */ 4107 case 1048: /* alternative cursor save */
4059 case 1049: 4108 case 1049:
4060 if (OPTION (Opt_secondaryScreen)) 4109 if (OPTION (Opt_secondaryScreen))
4061 if (mode == 0) 4110 if (mode == 0)
4291 scr_color (Color_bg, Color_bg); 4340 scr_color (Color_bg, Color_bg);
4292 break; 4341 break;
4293 4342
4294 //case 50: // not variable spacing 4343 //case 50: // not variable spacing
4295 4344
4296#ifndef NO_BRIGHTCOLOR 4345#if ENABLE_FRILLS
4297 case 90: 4346 case 90:
4298 case 91: /* set bright fg color */ 4347 case 91: /* set bright fg color */
4299 case 92: 4348 case 92:
4300 case 93: 4349 case 93:
4301 case 94: 4350 case 94:
4313 case 106: 4362 case 106:
4314 case 107: 4363 case 107:
4315 scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg); 4364 scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg);
4316 break; 4365 break;
4317#endif 4366#endif
4318
4319 } 4367 }
4320 } 4368 }
4321} 4369}
4322/*}}} */ 4370/*}}} */
4323 4371
4347 */ 4395 */
4348void 4396void
4349rxvt_term::tt_printf (const char *fmt,...) 4397rxvt_term::tt_printf (const char *fmt,...)
4350{ 4398{
4351 va_list arg_ptr; 4399 va_list arg_ptr;
4352 unsigned char buf[256]; 4400 char buf[256];
4353 4401
4354 va_start (arg_ptr, fmt); 4402 va_start (arg_ptr, fmt);
4355 vsnprintf ((char *)buf, 256, fmt, arg_ptr); 4403 vsnprintf ((char *)buf, 256, fmt, arg_ptr);
4356 va_end (arg_ptr); 4404 va_end (arg_ptr);
4357 tt_write (buf, strlen (buf)); 4405 tt_write (buf, strlen (buf));
4362 * or generated by us in response to a query ESC sequence. 4410 * or generated by us in response to a query ESC sequence.
4363 */ 4411 */
4364const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT 4412const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT
4365 4413
4366void 4414void
4367rxvt_term::tt_write (const unsigned char *data, unsigned int len) 4415rxvt_term::tt_write (const char *data, unsigned int len)
4368{ 4416{
4369 if (v_buflen == 0) 4417 if (v_buflen == 0)
4370 { 4418 {
4371 ssize_t written = write (pty.pty, data, min (len, MAX_PTY_WRITE)); 4419 ssize_t written = write (pty.pty, data, min (len, MAX_PTY_WRITE));
4372 4420
4375 4423
4376 data += written; 4424 data += written;
4377 len -= written; 4425 len -= written;
4378 } 4426 }
4379 4427
4380 v_buffer = (unsigned char *)realloc (v_buffer, v_buflen + len); 4428 v_buffer = (char *)realloc (v_buffer, v_buflen + len);
4381 4429
4382 memcpy (v_buffer + v_buflen, data, len); 4430 memcpy (v_buffer + v_buflen, data, len);
4383 v_buflen += len; 4431 v_buflen += len;
4384 4432
4385 pty_ev.set (EVENT_READ | EVENT_WRITE); 4433 pty_ev.set (EVENT_READ | EVENT_WRITE);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines