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.420 by root, Wed Oct 15 14:48:22 2008 UTC vs.
Revision 1.427 by root, Wed Nov 5 15:44:04 2008 UTC

1127 { 1127 {
1128 // this should really be sched_yield(), but the linux guys thought 1128 // this should really be sched_yield(), but the linux guys thought
1129 // that giving a process calling sched_yield () less cpu time than 1129 // that giving a process calling sched_yield () less cpu time than
1130 // ones with high nice levels is a useful thing to do. It surely is is 1130 // ones with high nice levels is a useful thing to do. It surely is is
1131 // allowed by the sus... as is returning ENOSYS. 1131 // allowed by the sus... as is returning ENOSYS.
1132 // since the linux guys additionally thought that breaking the only
1133 // known workaroudn against their unusable sched_yield hack is cool,
1134 // we just nanosleep a bit and hope for the best.
1132 1135
1133 struct timespec ts = { 0, 0 }; 1136 struct timespec ts = { 0, 1000 };
1134 nanosleep (&ts, 0); 1137 nanosleep (&ts, 0);
1135 1138
1136 w.stop (); 1139 w.stop ();
1137 } 1140 }
1138 1141
1188{ 1191{
1189 make_current (); 1192 make_current ();
1190 1193
1191 if (revents & ev::READ) 1194 if (revents & ev::READ)
1192 // loop, but don't allow a single term to monopolize us 1195 // loop, but don't allow a single term to monopolize us
1193 while (pty_fill ()) 1196 for (int i = CBUFCNT; i-- && pty_fill (); )
1194 if (cmd_parse ()) 1197 cmd_parse ();
1195 break;
1196 1198
1197 if (revents & ev::WRITE) 1199 if (revents & ev::WRITE)
1198 pty_write (); 1200 pty_write ();
1199 1201
1200 refresh_check (); 1202 refresh_check ();
2182 } 2184 }
2183} 2185}
2184 2186
2185/*}}} */ 2187/*}}} */
2186 2188
2187bool 2189void
2188rxvt_term::cmd_parse () 2190rxvt_term::cmd_parse ()
2189{ 2191{
2190 bool flag = false;
2191 wchar_t ch = NOCHAR; 2192 wchar_t ch = NOCHAR;
2192 char *seq_begin; // remember start of esc-sequence here 2193 char *seq_begin; // remember start of esc-sequence here
2193 2194
2194 for (;;) 2195 for (;;)
2195 { 2196 {
2289 * What the heck we'll cheat and only refresh less than every page-full. 2290 * What the heck we'll cheat and only refresh less than every page-full.
2290 * if skipScroll is enabled. 2291 * if skipScroll is enabled.
2291 */ 2292 */
2292 if (refreshnow) 2293 if (refreshnow)
2293 { 2294 {
2294 flag = true;
2295 scr_refresh (); 2295 scr_refresh ();
2296 want_refresh = 1; 2296 want_refresh = 1;
2297 } 2297 }
2298
2299 } 2298 }
2300 else 2299 else
2301 { 2300 {
2302 try 2301 try
2303 { 2302 {
2311 } 2310 }
2312 2311
2313 ch = NOCHAR; 2312 ch = NOCHAR;
2314 } 2313 }
2315 } 2314 }
2316
2317 return flag;
2318} 2315}
2319 2316
2320// read the next character 2317// read the next character
2321wchar_t 2318wchar_t
2322rxvt_term::next_char () NOTHROW 2319rxvt_term::next_char () NOTHROW
2691 /* 8.3.110: SINGLE CHARACTER INTRODUCER */ 2688 /* 8.3.110: SINGLE CHARACTER INTRODUCER */
2692 case C1_SCI: /* ESC Z */ 2689 case C1_SCI: /* ESC Z */
2693 tt_write (ESCZ_ANSWER, sizeof (ESCZ_ANSWER) - 1); 2690 tt_write (ESCZ_ANSWER, sizeof (ESCZ_ANSWER) - 1);
2694 break; /* steal obsolete ESC [ c */ 2691 break; /* steal obsolete ESC [ c */
2695 2692
2696 /* 8.3.16: CONTROL SEQUENCE INTRODUCER */ 2693 /* 8.3.16: CONTROL SEQUENCE INTRODUCER (CSI) */
2697 case C1_CSI: /* ESC [ */ 2694 case C1_CSI: /* ESC [ */
2698 process_csi_seq (); 2695 process_csi_seq ();
2699 break; 2696 break;
2700 2697
2701 /* 8.3.90: OPERATING SYSTEM COMMAND */ 2698 /* 8.3.90: OPERATING SYSTEM COMMAND (OSC) */
2702 case C1_OSC: /* ESC ] */ 2699 case C1_OSC: /* ESC ] */
2703 process_osc_seq (); 2700 process_osc_seq ();
2704 break; 2701 break;
2705 2702
2706 /* 8.3.106: RESET TO INITIAL STATE */ 2703 /* 8.3.106: RESET TO INITIAL STATE (RIS) */
2707 case 'c': 2704 case 'c':
2708 mbstate.reset (); 2705 mbstate.reset ();
2709 scr_poweron (); 2706 scr_poweron ();
2710 scrollBar.show (1); 2707 scrollBar.show (1);
2711 break; 2708 break;
2766 2763
2767 nargs = 0; 2764 nargs = 0;
2768 2765
2769 priv = 0; 2766 priv = 0;
2770 ch = cmd_getc (); 2767 ch = cmd_getc ();
2771 if (ch >= '<' && ch <= '?') 2768 if ((ch >= '<' && ch <= '?') || ch == '!')
2772 { 2769 {
2773 /* '<' '=' '>' '?' */ 2770 /* '<' '=' '>' '?' '!' */
2774 priv = ch; 2771 priv = ch;
2775 ch = cmd_getc (); 2772 ch = cmd_getc ();
2776 } 2773 }
2777 2774
2778 /* read any numerical arguments */ 2775 /* read any numerical arguments */
2832 2829
2833 case '?': 2830 case '?':
2834 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') 2831 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't')
2835 process_terminal_mode (ch, priv, nargs, arg); 2832 process_terminal_mode (ch, priv, nargs, arg);
2836 break; 2833 break;
2834
2835 case '!':
2836 if (ch == CSI_70)
2837 {
2838 /* DECSTR: soft terminal reset, used by our terminfo since 9.06 */
2839 scr_soft_reset ();
2840
2841 static const int pm_h[] = { 7, 25 };
2842 static const int pm_l[] = { 1, 3, 4, 5, 6, 9, 66, 1000, 1001, 1049 };
2843
2844 process_terminal_mode ('h', 0, sizeof (pm_h) / sizeof (pm_h[0]), pm_h);
2845 process_terminal_mode ('l', 0, sizeof (pm_l) / sizeof (pm_l[0]), pm_l);
2837 } 2846 }
2847 break;
2848 }
2849
2838 return; 2850 return;
2839 } 2851 }
2840 2852
2841 switch (ch) 2853 switch (ch)
2842 { 2854 {
3388 break; 3400 break;
3389 case URxvt_Color_IT: 3401 case URxvt_Color_IT:
3390 process_color_seq (op, Color_IT, str, resp); 3402 process_color_seq (op, Color_IT, str, resp);
3391 break; 3403 break;
3392#endif 3404#endif
3405 case URxvt_Color_border:
3406 process_color_seq (op, Color_border, str, resp);
3407 break;
3393#if ENABLE_TRANSPARENCY 3408#if ENABLE_TRANSPARENCY
3394 case URxvt_Color_tint: 3409 case URxvt_Color_tint:
3395 process_color_seq (op, Color_tint, str, resp); 3410 process_color_seq (op, Color_tint, str, resp);
3396 { 3411 {
3397 bool changed = false; 3412 bool changed = false;
3572 static const struct 3587 static const struct
3573 { 3588 {
3574 const int argval; 3589 const int argval;
3575 const unsigned long bit; 3590 const unsigned long bit;
3576 } argtopriv[] = { 3591 } argtopriv[] = {
3577 { 1, PrivMode_aplCUR }, 3592 { 1, PrivMode_aplCUR }, // DECCKM
3578 { 2, PrivMode_vt52 }, 3593 { 2, PrivMode_vt52 },
3579 { 3, PrivMode_132 }, 3594 { 3, PrivMode_132 }, // DECCOLM
3580 { 4, PrivMode_smoothScroll }, 3595 { 4, PrivMode_smoothScroll }, // DECSCLM
3581 { 5, PrivMode_rVideo }, 3596 { 5, PrivMode_rVideo }, // DECSCNM
3582 { 6, PrivMode_relOrigin }, 3597 { 6, PrivMode_relOrigin }, // DECOM
3583 { 7, PrivMode_Autowrap }, 3598 { 7, PrivMode_Autowrap }, // DECAWM
3584 // 8, bi-directional support mode 3599 // 8, auto-repeat keys // DECARM
3585 { 9, PrivMode_MouseX10 }, 3600 { 9, PrivMode_MouseX10 },
3586 // 18, 19 printing-related 3601 // 18 end FF to printer after print screen
3602 // 19 Print screen prints full screen/scorll region
3587 { 25, PrivMode_VisibleCursor }, 3603 { 25, PrivMode_VisibleCursor }, // cnorm/cvvis/civis
3588#ifdef scrollBar_esc 3604#ifdef scrollBar_esc
3589 { scrollBar_esc, PrivMode_scrollBar }, 3605 { scrollBar_esc, PrivMode_scrollBar },
3590#endif 3606#endif
3591 { 35, PrivMode_ShiftKeys }, // rxvt extension 3607 { 35, PrivMode_ShiftKeys }, // rxvt extension
3608 // 38, tektronix mode // DECTEK
3592 { 40, PrivMode_132OK }, 3609 { 40, PrivMode_132OK },
3593 // 41 xterm more fixes NYI 3610 // 41 xterm more fixes NYI
3594 // 45 margin bell NYI 3611 // 45 margin bell NYI
3595 // 46 start logging 3612 // 46 start logging
3596 { 47, PrivMode_Screen }, 3613 { 47, PrivMode_Screen },
3597 { 66, PrivMode_aplKP }, 3614 { 66, PrivMode_aplKP }, // DECPAM/DECPNM
3598#ifndef NO_BACKSPACE_KEY 3615#ifndef NO_BACKSPACE_KEY
3599 { 67, PrivMode_BackSpace }, 3616 { 67, PrivMode_BackSpace }, // DECBKM
3600#endif 3617#endif
3601 { 1000, PrivMode_MouseX11 }, 3618 { 1000, PrivMode_MouseX11 },
3602 { 1002, PrivMode_MouseBtnEvent }, 3619 { 1002, PrivMode_MouseBtnEvent },
3603 { 1003, PrivMode_MouseAnyEvent }, 3620 { 1003, PrivMode_MouseAnyEvent },
3604 { 1010, PrivMode_TtyOutputInh }, // rxvt extension 3621 { 1010, PrivMode_TtyOutputInh }, // rxvt extension
3666 */ 3683 */
3667 set_privmode (PrivMode_vt52, 1); 3684 set_privmode (PrivMode_vt52, 1);
3668 break; 3685 break;
3669 case 3: /* 80/132 */ 3686 case 3: /* 80/132 */
3670 if (priv_modes & PrivMode_132OK) 3687 if (priv_modes & PrivMode_132OK)
3671 {
3672 scr_poweron ();
3673 set_widthheight (((state ? 132 : 80) * fwidth), 24 * fheight); 3688 set_widthheight ((state ? 132 : 80) * fwidth, 24 * fheight);
3674 }
3675 break; 3689 break;
3676 case 4: /* smooth scrolling */ 3690 case 4: /* smooth scrolling */
3677 set_option (Opt_jumpScroll, !state); 3691 set_option (Opt_jumpScroll, !state);
3678 break; 3692 break;
3679 case 5: /* reverse video */ 3693 case 5: /* reverse video */
3721 priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent; 3735 priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent;
3722 vt_emask_mouse = PointerMotionMask; 3736 vt_emask_mouse = PointerMotionMask;
3723 } 3737 }
3724 else 3738 else
3725 vt_emask_mouse = NoEventMask; 3739 vt_emask_mouse = NoEventMask;
3740
3726 vt_select_input (); 3741 vt_select_input ();
3727 break; 3742 break;
3728 case 1010: /* scroll to bottom on TTY output inhibit */ 3743 case 1010: /* scroll to bottom on TTY output inhibit */
3729 set_option (Opt_scrollTtyOutput, !state); 3744 set_option (Opt_scrollTtyOutput, !state);
3730 break; 3745 break;
3733 break; 3748 break;
3734 case 1047: /* secondary screen w/ clearing last */ 3749 case 1047: /* secondary screen w/ clearing last */
3735 if (option (Opt_secondaryScreen)) 3750 if (option (Opt_secondaryScreen))
3736 if (current_screen != PRIMARY) 3751 if (current_screen != PRIMARY)
3737 scr_erase_screen (2); 3752 scr_erase_screen (2);
3753
3738 scr_change_screen (state); 3754 scr_change_screen (state);
3739 break; 3755 break;
3740 case 1049: /* secondary screen w/ clearing first */ 3756 case 1049: /* secondary screen w/ clearing first */
3741 scr_change_screen (state); 3757 scr_change_screen (state);
3742 if (option (Opt_secondaryScreen)) 3758 if (option (Opt_secondaryScreen))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines