… | |
… | |
2179 | wchar_t ch = NOCHAR; |
2179 | wchar_t ch = NOCHAR; |
2180 | char *seq_begin; // remember start of esc-sequence here |
2180 | char *seq_begin; // remember start of esc-sequence here |
2181 | |
2181 | |
2182 | for (;;) |
2182 | for (;;) |
2183 | { |
2183 | { |
2184 | if (ch == NOCHAR) |
2184 | if (expect_false (ch == NOCHAR)) |
2185 | { |
2185 | { |
2186 | seq_begin = cmdbuf_ptr; |
2186 | seq_begin = cmdbuf_ptr; |
2187 | ch = next_char (); |
2187 | ch = next_char (); |
2188 | |
2188 | |
2189 | if (ch == NOCHAR) |
2189 | if (ch == NOCHAR) |
2190 | break; |
2190 | break; |
2191 | } |
2191 | } |
2192 | |
2192 | |
2193 | if (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT) |
2193 | if (expect_true (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT)) |
2194 | { |
2194 | { |
2195 | if (!seen_input) |
2195 | if (expect_false (!seen_input)) |
2196 | { |
2196 | { |
2197 | seen_input = 1; |
2197 | seen_input = 1; |
2198 | // many badly-written programs (e.g. jed) contain a race condition: |
2198 | // many badly-written programs (e.g. jed) contain a race condition: |
2199 | // they first read the screensize and then install a SIGWINCH handler. |
2199 | // they first read the screensize and then install a SIGWINCH handler. |
2200 | // some window managers resize the window early, and these programs |
2200 | // some window managers resize the window early, and these programs |
… | |
… | |
2213 | wchar_t *str = buf; |
2213 | wchar_t *str = buf; |
2214 | wchar_t *eol = str + min (ncol, UBUFSIZ); |
2214 | wchar_t *eol = str + min (ncol, UBUFSIZ); |
2215 | |
2215 | |
2216 | for (;;) |
2216 | for (;;) |
2217 | { |
2217 | { |
2218 | if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)) |
2218 | if (expect_false (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT))) |
2219 | break; |
2219 | break; |
2220 | |
2220 | |
2221 | *str++ = ch; |
2221 | *str++ = ch; |
2222 | |
2222 | |
2223 | if (ch == C0_LF || str >= eol) |
2223 | if (expect_false (ch == C0_LF || str >= eol)) |
2224 | { |
2224 | { |
2225 | if (ch == C0_LF) |
2225 | if (ch == C0_LF) |
2226 | nlines++; |
2226 | nlines++; |
2227 | |
2227 | |
2228 | refresh_count++; |
2228 | refresh_count++; |
… | |
… | |
2310 | rxvt_term::next_char () NOTHROW |
2310 | rxvt_term::next_char () NOTHROW |
2311 | { |
2311 | { |
2312 | while (cmdbuf_ptr < cmdbuf_endp) |
2312 | while (cmdbuf_ptr < cmdbuf_endp) |
2313 | { |
2313 | { |
2314 | // assume 7-bit to be ascii ALWAYS |
2314 | // assume 7-bit to be ascii ALWAYS |
2315 | if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
2315 | if (expect_true ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b)) |
2316 | return *cmdbuf_ptr++; |
2316 | return *cmdbuf_ptr++; |
2317 | |
2317 | |
2318 | wchar_t wc; |
2318 | wchar_t wc; |
2319 | size_t len = mbrtowc (&wc, cmdbuf_ptr, cmdbuf_endp - cmdbuf_ptr, mbstate); |
2319 | size_t len = mbrtowc (&wc, cmdbuf_ptr, cmdbuf_endp - cmdbuf_ptr, mbstate); |
2320 | |
2320 | |