--- rxvt-unicode/src/rxvtperl.xs 2006/01/03 00:06:57 1.8 +++ rxvt-unicode/src/rxvtperl.xs 2006/01/03 02:01:27 1.11 @@ -298,6 +298,7 @@ BOOT: { # define set_hookname(sym) av_store (hookname, PP_CONCAT(HOOK_, sym), newSVpv (PP_STRINGIFY(sym), 0)) +# define export_const(name) newCONSTSUB (gv_stashpv ("urxvt", 1), #name, newSViv (name)); AV *hookname = get_av ("urxvt::HOOKNAME", 1); set_hookname (INIT); set_hookname (RESET); @@ -316,6 +317,14 @@ set_hookname (REFRESH_END); set_hookname (KEYBOARD_COMMAND); + export_const (DEFAULT_RSTYLE); + export_const (OVERLAY_RSTYLE); + export_const (RS_Bold); + export_const (RS_Italic); + export_const (RS_Blink); + export_const (RS_RVid); + export_const (RS_Uline); + sv_setpv (get_sv ("urxvt::LIBDIR", 1), LIBDIR); } @@ -341,6 +350,34 @@ OUTPUT: RETVAL +int +GET_BASEFG (int rend) + CODE: + RETVAL = GET_BASEFG (rend); + OUTPUT: + RETVAL + +int +GET_BASEBG (int rend) + CODE: + RETVAL = GET_BASEBG (rend); + OUTPUT: + RETVAL + +int +SET_FGCOLOR (int rend, int color) + CODE: + RETVAL = SET_FGCOLOR (rend, color); + OUTPUT: + RETVAL + +int +SET_BGCOLOR (int rend, int color) + CODE: + RETVAL = SET_BGCOLOR (rend, color); + OUTPUT: + RETVAL + MODULE = urxvt PACKAGE = urxvt::term int @@ -434,6 +471,11 @@ RETVAL void +rxvt_term::want_refresh () + CODE: + THIS->want_refresh = 1; + +void rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0) PPCODE: { @@ -466,17 +508,19 @@ int len = wcslen (wstr); - if (start_col + len > THIS->ncol) + if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) { free (wstr); - croak ("new_text extends beyond right margin"); + croak ("new_text extends beyond horizontal margins"); } for (int col = start_col; col < start_col + len; col++) { - l.t [col] = wstr [col]; + l.t [col] = wstr [col - start_col]; l.r [col] = SET_FONT (l.r [col], THIS->fontset [GET_STYLE (l.r [col])]->find_font (l.t [col])); } + + free (wstr); } } @@ -508,12 +552,12 @@ AV *av = (AV *)SvRV (new_rend); int len = av_len (av) + 1; - if (start_col + len > THIS->ncol) - croak ("new_rend array extends beyond right margin"); + if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) + croak ("new_rend array extends beyond horizontal margins"); for (int col = start_col; col < start_col + len; col++) { - rend_t r = SvIV (*av_fetch (av, col, 1)) & ~RS_fontMask; + rend_t r = SvIV (*av_fetch (av, col - start_col, 1)) & ~RS_fontMask; l.r [col] = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (l.t [col])); }