… | |
… | |
733 | rxvt_term::want_refresh () |
733 | rxvt_term::want_refresh () |
734 | CODE: |
734 | CODE: |
735 | THIS->want_refresh = 1; |
735 | THIS->want_refresh = 1; |
736 | |
736 | |
737 | void |
737 | void |
738 | rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0) |
738 | rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS) |
739 | PPCODE: |
739 | PPCODE: |
740 | { |
740 | { |
741 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
741 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
742 | XSRETURN_EMPTY; |
742 | XSRETURN_EMPTY; |
743 | |
743 | |
… | |
… | |
757 | |
757 | |
758 | if (new_text) |
758 | if (new_text) |
759 | { |
759 | { |
760 | wchar_t *wstr = sv2wcs (new_text); |
760 | wchar_t *wstr = sv2wcs (new_text); |
761 | |
761 | |
762 | int len = wcslen (wstr); |
762 | int len = min (wcslen (wstr) - start_ofs, max_len); |
763 | |
763 | |
764 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
764 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
765 | { |
765 | { |
766 | free (wstr); |
766 | free (wstr); |
767 | croak ("new_text extends beyond horizontal margins"); |
767 | croak ("new_text extends beyond horizontal margins"); |
768 | } |
768 | } |
769 | |
769 | |
770 | for (int col = start_col; col < start_col + len; col++) |
770 | for (int col = start_col; col < start_col + len; col++) |
771 | { |
771 | { |
772 | l.t [col] = wstr [col - start_col]; |
772 | l.t [col] = wstr [start_ofs + col - start_col]; |
773 | l.r [col] = SET_FONT (l.r [col], THIS->fontset [GET_STYLE (l.r [col])]->find_font (l.t [col])); |
773 | l.r [col] = SET_FONT (l.r [col], THIS->fontset [GET_STYLE (l.r [col])]->find_font (l.t [col])); |
774 | } |
774 | } |
775 | |
775 | |
776 | free (wstr); |
776 | free (wstr); |
777 | } |
777 | } |
778 | } |
778 | } |
779 | |
779 | |
780 | void |
780 | void |
781 | rxvt_term::ROW_r (int row_number, SV *new_rend = 0, int start_col = 0) |
781 | rxvt_term::ROW_r (int row_number, SV *new_rend = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS) |
782 | PPCODE: |
782 | PPCODE: |
783 | { |
783 | { |
784 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
784 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
785 | XSRETURN_EMPTY; |
785 | XSRETURN_EMPTY; |
786 | |
786 | |
… | |
… | |
801 | { |
801 | { |
802 | if (!SvROK (new_rend) || SvTYPE (SvRV (new_rend)) != SVt_PVAV) |
802 | if (!SvROK (new_rend) || SvTYPE (SvRV (new_rend)) != SVt_PVAV) |
803 | croak ("new_rend must be arrayref"); |
803 | croak ("new_rend must be arrayref"); |
804 | |
804 | |
805 | AV *av = (AV *)SvRV (new_rend); |
805 | AV *av = (AV *)SvRV (new_rend); |
806 | int len = av_len (av) + 1; |
806 | int len = min (av_len (av) + 1 - start_ofs, max_len); |
807 | |
807 | |
808 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
808 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
809 | croak ("new_rend array extends beyond horizontal margins"); |
809 | croak ("new_rend array extends beyond horizontal margins"); |
810 | |
810 | |
811 | for (int col = start_col; col < start_col + len; col++) |
811 | for (int col = start_col; col < start_col + len; col++) |
812 | { |
812 | { |
813 | rend_t r = SvIV (*av_fetch (av, col - start_col, 1)) & ~RS_fontMask; |
813 | rend_t r = SvIV (*av_fetch (av, start_ofs + col - start_col, 1)) & ~RS_fontMask; |
814 | |
814 | |
815 | l.r [col] = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (l.t [col])); |
815 | l.r [col] = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (l.t [col])); |
816 | } |
816 | } |
817 | } |
817 | } |
818 | } |
818 | } |