… | |
… | |
471 | char *str = SvPVutf8 (new_text, slen); |
471 | char *str = SvPVutf8 (new_text, slen); |
472 | wchar_t *wstr = rxvt_utf8towcs (str, slen); |
472 | wchar_t *wstr = rxvt_utf8towcs (str, slen); |
473 | |
473 | |
474 | int len = wcslen (wstr); |
474 | int len = wcslen (wstr); |
475 | |
475 | |
476 | if (start_col + len > THIS->ncol) |
476 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
477 | { |
477 | { |
478 | free (wstr); |
478 | free (wstr); |
479 | croak ("new_text extends beyond right margin"); |
479 | croak ("new_text extends beyond horizontal margins"); |
480 | } |
480 | } |
481 | |
481 | |
482 | for (int col = start_col; col < start_col + len; col++) |
482 | for (int col = start_col; col < start_col + len; col++) |
483 | { |
483 | { |
484 | l.t [col] = wstr [col - start_col]; |
484 | l.t [col] = wstr [col - start_col]; |
… | |
… | |
515 | croak ("new_rend must be arrayref"); |
515 | croak ("new_rend must be arrayref"); |
516 | |
516 | |
517 | AV *av = (AV *)SvRV (new_rend); |
517 | AV *av = (AV *)SvRV (new_rend); |
518 | int len = av_len (av) + 1; |
518 | int len = av_len (av) + 1; |
519 | |
519 | |
520 | if (start_col + len > THIS->ncol) |
520 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
521 | croak ("new_rend array extends beyond right margin"); |
521 | croak ("new_rend array extends beyond horizontal margins"); |
522 | |
522 | |
523 | for (int col = start_col; col < start_col + len; col++) |
523 | for (int col = start_col; col < start_col + len; col++) |
524 | { |
524 | { |
525 | rend_t r = SvIV (*av_fetch (av, col - start_col, 1)) & ~RS_fontMask; |
525 | rend_t r = SvIV (*av_fetch (av, col - start_col, 1)) & ~RS_fontMask; |
526 | |
526 | |