--- rxvt-unicode/src/command.C 2006/01/04 04:42:45 1.234 +++ rxvt-unicode/src/command.C 2006/01/06 05:28:55 1.241 @@ -869,6 +869,9 @@ } } + if (HOOK_INVOKE ((this, HOOK_KEY_PRESS, DT_XEVENT, &ev, DT_STRING_LEN, kbuf, len, DT_END))) + return; + if (len <= 0) return; /* not mapped */ @@ -969,6 +972,45 @@ if (want_refresh) { + if (SHOULD_INVOKE (HOOK_LINE_UPDATE)) + { + int row = -view_start; + + while (row > -nsaved && ROW (row - 1).is_longer ()) + --row; + + while (row < -view_start + nrow) + { + int start_row = row; + line_t *l; + + do + { + l = &ROW (row); + + if (!(l->f & LINE_FILTERED)) + { + // line not filtered, mark it as filtered + l->f |= LINE_FILTERED; + while (l->is_longer ()) + { + l = &ROW (++row); + l->f |= LINE_FILTERED; + } + + // and filter it + HOOK_INVOKE ((this, HOOK_LINE_UPDATE, DT_INT, start_row, DT_END)); + + break; + } + } + while (l->is_longer ()); + + row++; + } + + } + scr_refresh (refresh_type); scrollbar_show (1); #ifdef USE_XIM @@ -1165,7 +1207,7 @@ void rxvt_term::pointer_blank () { - if (! OPTION (Opt_pointerBlank)) + if (!OPTION (Opt_pointerBlank)) return; XDefineCursor (display->display, vt, display->blank_cursor); @@ -1375,6 +1417,9 @@ } #endif + if (ev.xany.window == vt && HOOK_INVOKE ((this, HOOK_KEY_RELEASE, DT_XEVENT, &ev, DT_END))) + break; + #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) if (!(ev.xkey.state & ControlMask)) slip_wheel_ev.stop (); @@ -1598,7 +1643,9 @@ if (ev.xany.window == vt) { - if (ev.xbutton.state & (Button1Mask | Button3Mask)) + if (HOOK_INVOKE ((this, HOOK_MOTION_NOTIFY, DT_XEVENT, &ev, DT_END))) + ; // nop + else if (ev.xbutton.state & (Button1Mask | Button3Mask)) { while (XCheckTypedWindowEvent (disp, vt, MotionNotify, &ev)) ; @@ -1704,7 +1751,7 @@ focus = 1; want_refresh = 1; - PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); + HOOK_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); #if USE_XIM if (Input_Context != NULL) @@ -1735,7 +1782,7 @@ focus = 0; want_refresh = 1; - PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); + HOOK_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); #if ENABLE_FRILLS || ISO_14755 if (iso14755buf) @@ -1857,7 +1904,7 @@ if (ev.button != MEvent.button) MEvent.clicks = 0; - if (!PERL_INVOKE ((this, HOOK_MOUSE_CLICK, DT_XEVENT, &ev, DT_END))) + if (!HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END))) switch (ev.button) { case Button1: @@ -2119,6 +2166,9 @@ && ev.button == Button1 && MEvent.clicks <= 1) selection_extend (ev.x, ev.y, 0); + if (!HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) + return; + switch (ev.button) { case Button1: @@ -2681,10 +2731,10 @@ { seq_begin = cmdbuf_ptr; ch = next_char (); - } - if (ch == NOCHAR) // TODO: improve - break; + if (ch == NOCHAR) + break; + } if (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT) { @@ -2735,7 +2785,9 @@ // scr_add_lines only works for nlines <= nrow - 1. if (nlines >= nrow - 1) { - scr_add_lines (buf, nlines, str - buf); + if (!HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_USTRING_LEN, buf, str - buf, DT_END))) + scr_add_lines (buf, nlines, str - buf); + nlines = 0; str = buf; eol = str + min (ncol, UBUFSIZ); @@ -2758,7 +2810,8 @@ ch = next_char (); } - scr_add_lines (buf, nlines, str - buf); + if (!HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_USTRING_LEN, buf, str - buf, DT_END))) + scr_add_lines (buf, nlines, str - buf); /* * If there have been a lot of new lines, then update the screen @@ -3974,7 +4027,7 @@ #if ENABLE_PERL case URxvt_perl: - if (PERL_INVOKE ((this, HOOK_OSC_SEQ, DT_STRING, str, DT_END))) + if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_STRING, str, DT_END))) ; // no responses yet break; #endif @@ -4342,7 +4395,7 @@ //case 50: // not variable spacing -#ifndef NO_BRIGHTCOLOR +#if ENABLE_FRILLS case 90: case 91: /* set bright fg color */ case 92: @@ -4414,6 +4467,9 @@ void rxvt_term::tt_write (const char *data, unsigned int len) { + if (pty.pty < 0) + return; + if (v_buflen == 0) { ssize_t written = write (pty.pty, data, min (len, MAX_PTY_WRITE));