… | |
… | |
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 | |
2190 | bool |
2189 | void |
2191 | rxvt_term::cmd_parse () |
2190 | rxvt_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 |
2324 | wchar_t |
2318 | wchar_t |
2325 | rxvt_term::next_char () NOTHROW |
2319 | rxvt_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 | { |