--- rxvt-unicode/src/command.C 2008/02/17 12:11:56 1.413 +++ rxvt-unicode/src/command.C 2008/10/10 13:23:56 1.419 @@ -1017,7 +1017,7 @@ } scr_refresh (); - scrollbar_show (1); + scrollBar.show (1); #ifdef USE_XIM IMSendSpot (); #endif @@ -1538,7 +1538,7 @@ if (scrollBar.state && ev.xany.window == scrollBar.win) { scrollBar.state = STATE_IDLE; - scrollbar_show (0); + scrollBar.show (0); } } break; @@ -1649,7 +1649,7 @@ scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, scrollBar.size ()); want_refresh = 1; - scrollbar_show (1); + scrollBar.show (1); } break; } @@ -2068,7 +2068,7 @@ if (scrollBar.state == STATE_UP || scrollBar.state == STATE_DOWN) { scrollBar.state = STATE_IDLE; - scrollbar_show (0); + scrollBar.show (0); } #ifdef SELECTION_SCROLLING @@ -2161,7 +2161,7 @@ # endif { scr_page (v, i); - scrollbar_show (1); + scrollBar.show (1); } } break; @@ -2181,7 +2181,7 @@ for (;;) { - if (ch == NOCHAR) + if (expect_false (ch == NOCHAR)) { seq_begin = cmdbuf_ptr; ch = next_char (); @@ -2190,9 +2190,9 @@ break; } - if (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT) + if (expect_true (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT)) { - if (!seen_input) + if (expect_false (!seen_input)) { seen_input = 1; // many badly-written programs (e.g. jed) contain a race condition: @@ -2215,12 +2215,12 @@ for (;;) { - if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)) + if (expect_false (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT))) break; *str++ = ch; - if (ch == C0_LF || str >= eol) + if (expect_false (ch == C0_LF || str >= eol)) { if (ch == C0_LF) nlines++; @@ -2312,7 +2312,7 @@ while (cmdbuf_ptr < cmdbuf_endp) { // assume 7-bit to be ascii ALWAYS - if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) + if (expect_true ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b)) return *cmdbuf_ptr++; wchar_t wc; @@ -2326,7 +2326,10 @@ } if (len == (size_t)-1) - return (unsigned char)*cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through + { + mbrtowc (0, 0, 0, mbstate); // reset now undefined conversion state + return (unsigned char)*cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through + } // assume wchar == unicode cmdbuf_ptr += len; @@ -2380,7 +2383,7 @@ FILE * rxvt_term::popen_printer () { - FILE *stream = popen (rs[Rs_print_pipe], "w"); + FILE *stream = popen (rs[Rs_print_pipe] ? rs[Rs_print_pipe] : PRINTPIPE, "w"); if (stream == NULL) rxvt_warn ("can't open printer pipe, not printing.\n"); @@ -2401,17 +2404,16 @@ void rxvt_term::process_print_pipe () { - int done; - FILE *fd; + FILE *fd = popen_printer (); - if ((fd = popen_printer ()) == NULL) + if (!fd) return; /* * Send all input to the printer until either ESC[4i or ESC[?4i * is received. */ - for (done = 0; !done;) + for (int done = 0; !done; ) { unsigned char buf[8]; unicode_t ch; @@ -2693,7 +2695,7 @@ case 'c': mbstate.reset (); scr_poweron (); - scrollbar_show (1); + scrollBar.show (1); break; /* 8.3.79: LOCKING-SHIFT TWO (see ISO2022) */ @@ -3509,8 +3511,7 @@ #if ENABLE_PERL case URxvt_perl: - if (HOOK_INVOKE ((this, HOOK_OSC_SEQ_PERL, DT_STR, str, DT_END))) - ; // no responses yet + HOOK_INVOKE ((this, HOOK_OSC_SEQ_PERL, DT_STR, str, DT_STR_LEN, &resp, 1, DT_END)); break; #endif } @@ -3679,7 +3680,7 @@ break; #ifdef scrollBar_esc case scrollBar_esc: - if (scrollbar_mapping (state)) + if (scrollBar.map (state)) { resize_all_windows (0, 0, 0); scr_touch (true);