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.421 by root, Wed Oct 15 17:16:47 2008 UTC vs.
Revision 1.429 by root, Wed Nov 5 16:21:18 2008 UTC

1191{ 1191{
1192 make_current (); 1192 make_current ();
1193 1193
1194 if (revents & ev::READ) 1194 if (revents & ev::READ)
1195 // loop, but don't allow a single term to monopolize us 1195 // loop, but don't allow a single term to monopolize us
1196 while (pty_fill ()) 1196 for (int i = CBUFCNT; i-- && pty_fill (); )
1197 if (cmd_parse ()) 1197 cmd_parse ();
1198 break;
1199 1198
1200 if (revents & ev::WRITE) 1199 if (revents & ev::WRITE)
1201 pty_write (); 1200 pty_write ();
1202 1201
1203 refresh_check (); 1202 refresh_check ();
2185 } 2184 }
2186} 2185}
2187 2186
2188/*}}} */ 2187/*}}} */
2189 2188
2190bool 2189void
2191rxvt_term::cmd_parse () 2190rxvt_term::cmd_parse ()
2192{ 2191{
2193 bool flag = false;
2194 wchar_t ch = NOCHAR; 2192 wchar_t ch = NOCHAR;
2195 char *seq_begin; // remember start of esc-sequence here 2193 char *seq_begin; // remember start of esc-sequence here
2196 2194
2197 for (;;) 2195 for (;;)
2198 { 2196 {
2292 * 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.
2293 * if skipScroll is enabled. 2291 * if skipScroll is enabled.
2294 */ 2292 */
2295 if (refreshnow) 2293 if (refreshnow)
2296 { 2294 {
2297 flag = true;
2298 scr_refresh (); 2295 scr_refresh ();
2299 want_refresh = 1; 2296 want_refresh = 1;
2300 } 2297 }
2301
2302 } 2298 }
2303 else 2299 else
2304 { 2300 {
2305 try 2301 try
2306 { 2302 {
2314 } 2310 }
2315 2311
2316 ch = NOCHAR; 2312 ch = NOCHAR;
2317 } 2313 }
2318 } 2314 }
2319
2320 return flag;
2321} 2315}
2322 2316
2323// read the next character 2317// read the next character
2324wchar_t 2318wchar_t
2325rxvt_term::next_char () NOTHROW 2319rxvt_term::next_char () NOTHROW
2694 /* 8.3.110: SINGLE CHARACTER INTRODUCER */ 2688 /* 8.3.110: SINGLE CHARACTER INTRODUCER */
2695 case C1_SCI: /* ESC Z */ 2689 case C1_SCI: /* ESC Z */
2696 tt_write (ESCZ_ANSWER, sizeof (ESCZ_ANSWER) - 1); 2690 tt_write (ESCZ_ANSWER, sizeof (ESCZ_ANSWER) - 1);
2697 break; /* steal obsolete ESC [ c */ 2691 break; /* steal obsolete ESC [ c */
2698 2692
2699 /* 8.3.16: CONTROL SEQUENCE INTRODUCER */ 2693 /* 8.3.16: CONTROL SEQUENCE INTRODUCER (CSI) */
2700 case C1_CSI: /* ESC [ */ 2694 case C1_CSI: /* ESC [ */
2701 process_csi_seq (); 2695 process_csi_seq ();
2702 break; 2696 break;
2703 2697
2704 /* 8.3.90: OPERATING SYSTEM COMMAND */ 2698 /* 8.3.90: OPERATING SYSTEM COMMAND (OSC) */
2705 case C1_OSC: /* ESC ] */ 2699 case C1_OSC: /* ESC ] */
2706 process_osc_seq (); 2700 process_osc_seq ();
2707 break; 2701 break;
2708 2702
2709 /* 8.3.106: RESET TO INITIAL STATE */ 2703 /* 8.3.106: RESET TO INITIAL STATE (RIS) */
2710 case 'c': 2704 case 'c':
2711 mbstate.reset (); 2705 mbstate.reset ();
2712 scr_poweron (); 2706 scr_poweron ();
2713 scrollBar.show (1); 2707 scrollBar.show (1);
2714 break; 2708 break;
2769 2763
2770 nargs = 0; 2764 nargs = 0;
2771 2765
2772 priv = 0; 2766 priv = 0;
2773 ch = cmd_getc (); 2767 ch = cmd_getc ();
2774 if (ch >= '<' && ch <= '?') 2768 if ((ch >= '<' && ch <= '?') || ch == '!')
2775 { 2769 {
2776 /* '<' '=' '>' '?' */ 2770 /* '<' '=' '>' '?' '!' */
2777 priv = ch; 2771 priv = ch;
2778 ch = cmd_getc (); 2772 ch = cmd_getc ();
2779 } 2773 }
2780 2774
2781 /* read any numerical arguments */ 2775 /* read any numerical arguments */
2835 2829
2836 case '?': 2830 case '?':
2837 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') 2831 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't')
2838 process_terminal_mode (ch, priv, nargs, arg); 2832 process_terminal_mode (ch, priv, nargs, arg);
2839 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);
2840 } 2846 }
2847 break;
2848 }
2849
2841 return; 2850 return;
2842 } 2851 }
2843 2852
2844 switch (ch) 2853 switch (ch)
2845 { 2854 {
3391 break; 3400 break;
3392 case URxvt_Color_IT: 3401 case URxvt_Color_IT:
3393 process_color_seq (op, Color_IT, str, resp); 3402 process_color_seq (op, Color_IT, str, resp);
3394 break; 3403 break;
3395#endif 3404#endif
3405 case URxvt_Color_border:
3406 process_color_seq (op, Color_border, str, resp);
3407 break;
3396#if ENABLE_TRANSPARENCY 3408#if ENABLE_TRANSPARENCY
3397 case URxvt_Color_tint: 3409 case URxvt_Color_tint:
3398 process_color_seq (op, Color_tint, str, resp); 3410 process_color_seq (op, Color_tint, str, resp);
3399 { 3411 {
3400 bool changed = false; 3412 bool changed = false;
3575 static const struct 3587 static const struct
3576 { 3588 {
3577 const int argval; 3589 const int argval;
3578 const unsigned long bit; 3590 const unsigned long bit;
3579 } argtopriv[] = { 3591 } argtopriv[] = {
3580 { 1, PrivMode_aplCUR }, 3592 { 1, PrivMode_aplCUR }, // DECCKM
3581 { 2, PrivMode_vt52 }, 3593 { 2, PrivMode_vt52 },
3582 { 3, PrivMode_132 }, 3594 { 3, PrivMode_132 }, // DECCOLM
3583 { 4, PrivMode_smoothScroll }, 3595 { 4, PrivMode_smoothScroll }, // DECSCLM
3584 { 5, PrivMode_rVideo }, 3596 { 5, PrivMode_rVideo }, // DECSCNM
3585 { 6, PrivMode_relOrigin }, 3597 { 6, PrivMode_relOrigin }, // DECOM
3586 { 7, PrivMode_Autowrap }, 3598 { 7, PrivMode_Autowrap }, // DECAWM
3587 // 8, bi-directional support mode 3599 // 8, auto-repeat keys // DECARM
3588 { 9, PrivMode_MouseX10 }, 3600 { 9, PrivMode_MouseX10 },
3589 // 18, 19 printing-related 3601 // 18 end FF to printer after print screen
3602 // 19 Print screen prints full screen/scorll region
3590 { 25, PrivMode_VisibleCursor }, 3603 { 25, PrivMode_VisibleCursor }, // cnorm/cvvis/civis
3591#ifdef scrollBar_esc 3604#ifdef scrollBar_esc
3592 { scrollBar_esc, PrivMode_scrollBar }, 3605 { scrollBar_esc, PrivMode_scrollBar },
3593#endif 3606#endif
3594 { 35, PrivMode_ShiftKeys }, // rxvt extension 3607 { 35, PrivMode_ShiftKeys }, // rxvt extension
3608 // 38, tektronix mode // DECTEK
3595 { 40, PrivMode_132OK }, 3609 { 40, PrivMode_132OK },
3596 // 41 xterm more fixes NYI 3610 // 41 xterm more fixes NYI
3597 // 45 margin bell NYI 3611 // 45 margin bell NYI
3598 // 46 start logging 3612 // 46 start logging
3599 { 47, PrivMode_Screen }, 3613 { 47, PrivMode_Screen },
3600 { 66, PrivMode_aplKP }, 3614 { 66, PrivMode_aplKP }, // DECPAM/DECPNM
3601#ifndef NO_BACKSPACE_KEY 3615#ifndef NO_BACKSPACE_KEY
3602 { 67, PrivMode_BackSpace }, 3616 { 67, PrivMode_BackSpace }, // DECBKM
3603#endif 3617#endif
3604 { 1000, PrivMode_MouseX11 }, 3618 { 1000, PrivMode_MouseX11 },
3605 { 1002, PrivMode_MouseBtnEvent }, 3619 { 1002, PrivMode_MouseBtnEvent },
3606 { 1003, PrivMode_MouseAnyEvent }, 3620 { 1003, PrivMode_MouseAnyEvent },
3607 { 1010, PrivMode_TtyOutputInh }, // rxvt extension 3621 { 1010, PrivMode_TtyOutputInh }, // rxvt extension
3646 3660
3647 scr_touch (true); 3661 scr_touch (true);
3648 break; 3662 break;
3649#endif 3663#endif
3650 case 1048: /* alternative cursor save */ 3664 case 1048: /* alternative cursor save */
3651 case 1049:
3652 if (option (Opt_secondaryScreen)) 3665 if (option (Opt_secondaryScreen))
3653 if (mode == 0) 3666 if (mode == 0)
3654 scr_cursor (RESTORE); 3667 scr_cursor (RESTORE);
3655 else if (mode == 1) 3668 else if (mode == 1)
3656 scr_cursor (SAVE); 3669 scr_cursor (SAVE);
3669 */ 3682 */
3670 set_privmode (PrivMode_vt52, 1); 3683 set_privmode (PrivMode_vt52, 1);
3671 break; 3684 break;
3672 case 3: /* 80/132 */ 3685 case 3: /* 80/132 */
3673 if (priv_modes & PrivMode_132OK) 3686 if (priv_modes & PrivMode_132OK)
3674 {
3675 scr_poweron ();
3676 set_widthheight (((state ? 132 : 80) * fwidth), 24 * fheight); 3687 set_widthheight ((state ? 132 : 80) * fwidth, 24 * fheight);
3677 }
3678 break; 3688 break;
3679 case 4: /* smooth scrolling */ 3689 case 4: /* smooth scrolling */
3680 set_option (Opt_jumpScroll, !state); 3690 set_option (Opt_jumpScroll, !state);
3681 break; 3691 break;
3682 case 5: /* reverse video */ 3692 case 5: /* reverse video */
3724 priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent; 3734 priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent;
3725 vt_emask_mouse = PointerMotionMask; 3735 vt_emask_mouse = PointerMotionMask;
3726 } 3736 }
3727 else 3737 else
3728 vt_emask_mouse = NoEventMask; 3738 vt_emask_mouse = NoEventMask;
3739
3729 vt_select_input (); 3740 vt_select_input ();
3730 break; 3741 break;
3731 case 1010: /* scroll to bottom on TTY output inhibit */ 3742 case 1010: /* scroll to bottom on TTY output inhibit */
3732 set_option (Opt_scrollTtyOutput, !state); 3743 set_option (Opt_scrollTtyOutput, !state);
3733 break; 3744 break;
3734 case 1011: /* scroll to bottom on key press */ 3745 case 1011: /* scroll to bottom on key press */
3735 set_option (Opt_scrollTtyKeypress, state); 3746 set_option (Opt_scrollTtyKeypress, state);
3736 break; 3747 break;
3737 case 1047: /* secondary screen w/ clearing last */ 3748 case 1047: /* secondary screen w/ clearing last */
3738 if (option (Opt_secondaryScreen)) 3749 if (option (Opt_secondaryScreen))
3739 if (current_screen != PRIMARY) 3750 if (!state)
3740 scr_erase_screen (2); 3751 scr_erase_screen (2);
3752
3741 scr_change_screen (state); 3753 scr_change_screen (state);
3742 break; 3754 break;
3743 case 1049: /* secondary screen w/ clearing first */ 3755 case 1049: /* secondary screen w/ clearing first */
3756 if (option (Opt_secondaryScreen))
3757 if (state)
3758 scr_cursor (SAVE);
3759
3744 scr_change_screen (state); 3760 scr_change_screen (state);
3761
3745 if (option (Opt_secondaryScreen)) 3762 if (option (Opt_secondaryScreen))
3746 if (current_screen != PRIMARY) 3763 if (state)
3747 scr_erase_screen (2); 3764 scr_erase_screen (2);
3765 else
3766 scr_cursor (RESTORE);
3748 break; 3767 break;
3749 default: 3768 default:
3750 break; 3769 break;
3751 } 3770 }
3752 } 3771 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines