… | |
… | |
544 | export_const (RS_Uline); |
544 | export_const (RS_Uline); |
545 | |
545 | |
546 | sv_setpv (get_sv ("urxvt::LIBDIR", 1), LIBDIR); |
546 | sv_setpv (get_sv ("urxvt::LIBDIR", 1), LIBDIR); |
547 | } |
547 | } |
548 | |
548 | |
|
|
549 | SV * |
|
|
550 | new (...) |
|
|
551 | CODE: |
|
|
552 | { |
|
|
553 | stringvec *argv = new stringvec; |
|
|
554 | bool success; |
|
|
555 | |
|
|
556 | for (int i = 0; i < items ;i++) |
|
|
557 | argv->push_back (strdup (SvPVbyte_nolen (ST (i)))); |
|
|
558 | |
|
|
559 | rxvt_term *term = new rxvt_term; |
|
|
560 | |
|
|
561 | term->argv = argv; |
|
|
562 | |
|
|
563 | try |
|
|
564 | { |
|
|
565 | if (!term->init (argv->size (), argv->begin ())) |
|
|
566 | term = 0; |
|
|
567 | } |
|
|
568 | catch (const class rxvt_failure_exception &e) |
|
|
569 | { |
|
|
570 | term->destroy (); |
|
|
571 | croak ("exception caught while initializing new terminal instance"); |
|
|
572 | } |
|
|
573 | |
|
|
574 | RETVAL = term && term->self ? newSVterm (term) : &PL_sv_undef; |
|
|
575 | } |
|
|
576 | OUTPUT: |
|
|
577 | RETVAL |
|
|
578 | |
549 | void |
579 | void |
550 | set_should_invoke (int htype, int value) |
580 | set_should_invoke (int htype, int value) |
551 | CODE: |
581 | CODE: |
552 | rxvt_perl.should_invoke [htype] = value; |
582 | rxvt_perl.should_invoke [htype] = value; |
553 | |
583 | |
… | |
… | |
615 | } |
645 | } |
616 | OUTPUT: |
646 | OUTPUT: |
617 | RETVAL |
647 | RETVAL |
618 | |
648 | |
619 | MODULE = urxvt PACKAGE = urxvt::term |
649 | MODULE = urxvt PACKAGE = urxvt::term |
|
|
650 | |
|
|
651 | void |
|
|
652 | rxvt_term::destroy () |
620 | |
653 | |
621 | int |
654 | int |
622 | rxvt_term::strwidth (SV *str) |
655 | rxvt_term::strwidth (SV *str) |
623 | CODE: |
656 | CODE: |
624 | { |
657 | { |
… | |
… | |
733 | rxvt_term::want_refresh () |
766 | rxvt_term::want_refresh () |
734 | CODE: |
767 | CODE: |
735 | THIS->want_refresh = 1; |
768 | THIS->want_refresh = 1; |
736 | |
769 | |
737 | void |
770 | void |
738 | rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0) |
771 | 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: |
772 | PPCODE: |
740 | { |
773 | { |
741 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
774 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
742 | XSRETURN_EMPTY; |
775 | XSRETURN_EMPTY; |
743 | |
776 | |
… | |
… | |
757 | |
790 | |
758 | if (new_text) |
791 | if (new_text) |
759 | { |
792 | { |
760 | wchar_t *wstr = sv2wcs (new_text); |
793 | wchar_t *wstr = sv2wcs (new_text); |
761 | |
794 | |
762 | int len = wcslen (wstr); |
795 | int len = min (wcslen (wstr) - start_ofs, max_len); |
763 | |
796 | |
764 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
797 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
765 | { |
798 | { |
766 | free (wstr); |
799 | free (wstr); |
767 | croak ("new_text extends beyond horizontal margins"); |
800 | croak ("new_text extends beyond horizontal margins"); |
768 | } |
801 | } |
769 | |
802 | |
770 | for (int col = start_col; col < start_col + len; col++) |
803 | for (int col = start_col; col < start_col + len; col++) |
771 | { |
804 | { |
772 | l.t [col] = wstr [col - start_col]; |
805 | 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])); |
806 | l.r [col] = SET_FONT (l.r [col], THIS->fontset [GET_STYLE (l.r [col])]->find_font (l.t [col])); |
774 | } |
807 | } |
775 | |
808 | |
776 | free (wstr); |
809 | free (wstr); |
777 | } |
810 | } |
778 | } |
811 | } |
779 | |
812 | |
780 | void |
813 | void |
781 | rxvt_term::ROW_r (int row_number, SV *new_rend = 0, int start_col = 0) |
814 | 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: |
815 | PPCODE: |
783 | { |
816 | { |
784 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
817 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
785 | XSRETURN_EMPTY; |
818 | XSRETURN_EMPTY; |
786 | |
819 | |
… | |
… | |
801 | { |
834 | { |
802 | if (!SvROK (new_rend) || SvTYPE (SvRV (new_rend)) != SVt_PVAV) |
835 | if (!SvROK (new_rend) || SvTYPE (SvRV (new_rend)) != SVt_PVAV) |
803 | croak ("new_rend must be arrayref"); |
836 | croak ("new_rend must be arrayref"); |
804 | |
837 | |
805 | AV *av = (AV *)SvRV (new_rend); |
838 | AV *av = (AV *)SvRV (new_rend); |
806 | int len = av_len (av) + 1; |
839 | int len = min (av_len (av) + 1 - start_ofs, max_len); |
807 | |
840 | |
808 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
841 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
809 | croak ("new_rend array extends beyond horizontal margins"); |
842 | croak ("new_rend array extends beyond horizontal margins"); |
810 | |
843 | |
811 | for (int col = start_col; col < start_col + len; col++) |
844 | for (int col = start_col; col < start_col + len; col++) |
812 | { |
845 | { |
813 | rend_t r = SvIV (*av_fetch (av, col - start_col, 1)) & ~RS_fontMask; |
846 | rend_t r = SvIV (*av_fetch (av, start_ofs + col - start_col, 1)) & ~RS_fontMask; |
814 | |
847 | |
815 | l.r [col] = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (l.t [col])); |
848 | l.r [col] = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (l.t [col])); |
816 | } |
849 | } |
817 | } |
850 | } |
818 | } |
851 | } |
… | |
… | |
977 | STRLEN len; |
1010 | STRLEN len; |
978 | char *str = SvPVbyte (octets, len); |
1011 | char *str = SvPVbyte (octets, len); |
979 | C_ARGS: |
1012 | C_ARGS: |
980 | str, len |
1013 | str, len |
981 | |
1014 | |
|
|
1015 | void |
|
|
1016 | rxvt_term::cmd_parse (SV *octets) |
|
|
1017 | CODE: |
|
|
1018 | { |
|
|
1019 | STRLEN len; |
|
|
1020 | char *str = SvPVbyte (octets, len); |
|
|
1021 | |
|
|
1022 | char *old_cmdbuf_ptr = THIS->cmdbuf_ptr; |
|
|
1023 | char *old_cmdbuf_endp = THIS->cmdbuf_endp; |
|
|
1024 | |
|
|
1025 | THIS->cmdbuf_ptr = str; |
|
|
1026 | THIS->cmdbuf_endp = str + len; |
|
|
1027 | |
|
|
1028 | THIS->cmd_parse (); |
|
|
1029 | |
|
|
1030 | THIS->cmdbuf_ptr = old_cmdbuf_ptr; |
|
|
1031 | THIS->cmdbuf_endp = old_cmdbuf_endp; |
|
|
1032 | } |
|
|
1033 | |
982 | SV * |
1034 | SV * |
983 | rxvt_term::overlay (int x, int y, int w, int h, int rstyle = OVERLAY_RSTYLE, int border = 2) |
1035 | rxvt_term::overlay (int x, int y, int w, int h, int rstyle = OVERLAY_RSTYLE, int border = 2) |
984 | CODE: |
1036 | CODE: |
985 | { |
1037 | { |
986 | overlay *o = new overlay (THIS, x, y, w, h, rstyle, border); |
1038 | overlay *o = new overlay (THIS, x, y, w, h, rstyle, border); |