… | |
… | |
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 | |
2187 | bool |
2189 | void |
2188 | rxvt_term::cmd_parse () |
2190 | rxvt_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 |
2321 | wchar_t |
2318 | wchar_t |
2322 | rxvt_term::next_char () NOTHROW |
2319 | rxvt_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 | { |