… | |
… | |
26 | #include <XSUB.h> |
26 | #include <XSUB.h> |
27 | #undef line_t |
27 | #undef line_t |
28 | |
28 | |
29 | #include "../config.h" |
29 | #include "../config.h" |
30 | |
30 | |
|
|
31 | #include <cstddef> |
31 | #include <cstdarg> |
32 | #include <cstdarg> |
32 | |
33 | |
33 | #include "rxvt.h" |
34 | #include "rxvt.h" |
34 | #include "iom.h" |
35 | #include "iom.h" |
35 | #include "rxvtutil.h" |
36 | #include "rxvtutil.h" |
… | |
… | |
101 | croak ("perl code used %s object, but C++ object is already destroyed, caught", klass); |
102 | croak ("perl code used %s object, but C++ object is already destroyed, caught", klass); |
102 | |
103 | |
103 | return (long)mg->mg_ptr; |
104 | return (long)mg->mg_ptr; |
104 | } |
105 | } |
105 | |
106 | |
106 | #define newSVterm(term) SvREFCNT_inc ((SV *)term->self) |
107 | #define newSVterm(term) SvREFCNT_inc ((SV *)term->perl.self) |
107 | #define SvTERM(sv) (rxvt_term *)SvPTR (sv, "urxvt::term") |
108 | #define SvTERM(sv) (rxvt_term *)SvPTR (sv, "urxvt::term") |
108 | |
109 | |
109 | ///////////////////////////////////////////////////////////////////////////// |
110 | ///////////////////////////////////////////////////////////////////////////// |
110 | |
111 | |
111 | struct perl_watcher |
112 | struct perl_watcher |
… | |
… | |
290 | void |
291 | void |
291 | overlay::show () |
292 | overlay::show () |
292 | { |
293 | { |
293 | char key[33]; sprintf (key, "%32lx", (long)this); |
294 | char key[33]; sprintf (key, "%32lx", (long)this); |
294 | |
295 | |
295 | HV *hv = (HV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)THIS->self), "_overlay", 8, 0)); |
296 | HV *hv = (HV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)THIS->perl.self), "_overlay", 8, 0)); |
296 | hv_store (hv, key, 32, newSViv ((long)this), 0); |
297 | hv_store (hv, key, 32, newSViv ((long)this), 0); |
297 | } |
298 | } |
298 | |
299 | |
299 | void |
300 | void |
300 | overlay::hide () |
301 | overlay::hide () |
301 | { |
302 | { |
302 | SV **ovs = hv_fetch ((HV *)SvRV ((SV *)THIS->self), "_overlay", 8, 0); |
303 | SV **ovs = hv_fetch ((HV *)SvRV ((SV *)THIS->perl.self), "_overlay", 8, 0); |
303 | |
304 | |
304 | if (ovs) |
305 | if (ovs) |
305 | { |
306 | { |
306 | char key[33]; sprintf (key, "%32lx", (long)this); |
307 | char key[33]; sprintf (key, "%32lx", (long)this); |
307 | |
308 | |
… | |
… | |
415 | if (!perl) |
416 | if (!perl) |
416 | return false; |
417 | return false; |
417 | |
418 | |
418 | if (htype == HOOK_INIT) // first hook ever called |
419 | if (htype == HOOK_INIT) // first hook ever called |
419 | { |
420 | { |
420 | term->self = (void *)newSVptr ((void *)term, "urxvt::term"); |
421 | term->perl.self = (void *)newSVptr ((void *)term, "urxvt::term"); |
421 | hv_store ((HV *)SvRV ((SV *)term->self), "_overlay", 8, newRV_noinc ((SV *)newHV ()), 0); |
422 | hv_store ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, newRV_noinc ((SV *)newHV ()), 0); |
422 | } |
423 | } |
423 | else if (!term->self) |
424 | else if (!term->perl.self) |
424 | return false; // perl not initialized for this instance |
425 | return false; // perl not initialized for this instance |
425 | else if (htype == HOOK_DESTROY) |
426 | else if (htype == HOOK_DESTROY) |
426 | { |
427 | { |
427 | // handled later |
428 | // handled later |
428 | } |
429 | } |
429 | else if (htype == HOOK_REFRESH_BEGIN || htype == HOOK_REFRESH_END) |
430 | else if (htype == HOOK_REFRESH_BEGIN || htype == HOOK_REFRESH_END) |
430 | { |
431 | { |
431 | HV *hv = (HV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->self), "_overlay", 8, 0)); |
432 | HV *hv = (HV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0)); |
432 | |
433 | |
433 | if (HvKEYS (hv)) |
434 | if (HvKEYS (hv)) |
434 | { |
435 | { |
435 | hv_iterinit (hv); |
436 | hv_iterinit (hv); |
436 | |
437 | |
… | |
… | |
465 | |
466 | |
466 | case DT_LONG: |
467 | case DT_LONG: |
467 | XPUSHs (sv_2mortal (newSViv (va_arg (ap, long)))); |
468 | XPUSHs (sv_2mortal (newSViv (va_arg (ap, long)))); |
468 | break; |
469 | break; |
469 | |
470 | |
470 | case DT_STRING: |
471 | case DT_STR: |
471 | XPUSHs (sv_2mortal (newSVpv (va_arg (ap, char *), 0))); |
472 | XPUSHs (sv_2mortal (newSVpv (va_arg (ap, char *), 0))); |
472 | break; |
473 | break; |
473 | |
474 | |
474 | case DT_STRING_LEN: |
475 | case DT_STR_LEN: |
475 | { |
476 | { |
476 | char *str = va_arg (ap, char *); |
477 | char *str = va_arg (ap, char *); |
477 | int len = va_arg (ap, int); |
478 | int len = va_arg (ap, int); |
478 | |
479 | |
479 | XPUSHs (sv_2mortal (newSVpvn (str, len))); |
480 | XPUSHs (sv_2mortal (newSVpvn (str, len))); |
480 | } |
481 | } |
481 | break; |
482 | break; |
|
|
483 | |
|
|
484 | case DT_WCS_LEN: |
|
|
485 | { |
|
|
486 | wchar_t *wstr = va_arg (ap, wchar_t *); |
|
|
487 | int wlen = va_arg (ap, int); |
|
|
488 | |
|
|
489 | XPUSHs (sv_2mortal (wcs2sv (wstr, wlen))); |
|
|
490 | } |
|
|
491 | break; |
482 | |
492 | |
483 | case DT_XEVENT: |
493 | case DT_XEVENT: |
484 | { |
494 | { |
485 | XEvent *xe = va_arg (ap, XEvent *); |
495 | XEvent *xe = va_arg (ap, XEvent *); |
486 | HV *hv = newHV (); |
496 | HV *hv = newHV (); |
… | |
… | |
530 | |
540 | |
531 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); |
541 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); |
532 | } |
542 | } |
533 | break; |
543 | break; |
534 | |
544 | |
535 | case DT_USTRING_LEN: |
|
|
536 | { |
|
|
537 | unicode_t *ustr = va_arg (ap, unicode_t *); |
|
|
538 | int ulen = va_arg (ap, int); |
|
|
539 | wchar_t *wstr = new wchar_t [ulen]; |
|
|
540 | |
|
|
541 | for (int i = ulen; i--; ) |
|
|
542 | wstr [i] = ustr [i]; |
|
|
543 | |
|
|
544 | XPUSHs (sv_2mortal (wcs2sv (wstr, ulen))); |
|
|
545 | |
|
|
546 | delete [] wstr; |
|
|
547 | } |
|
|
548 | |
|
|
549 | case DT_END: |
545 | case DT_END: |
550 | { |
546 | { |
551 | va_end (ap); |
547 | va_end (ap); |
552 | |
548 | |
553 | PUTBACK; |
549 | PUTBACK; |
… | |
… | |
567 | if (SvTRUE (ERRSV)) |
563 | if (SvTRUE (ERRSV)) |
568 | rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPV_nolen (ERRSV)); |
564 | rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPV_nolen (ERRSV)); |
569 | |
565 | |
570 | if (htype == HOOK_DESTROY) |
566 | if (htype == HOOK_DESTROY) |
571 | { |
567 | { |
572 | clearSVptr ((SV *)term->self); |
568 | clearSVptr ((SV *)term->perl.self); |
573 | SvREFCNT_dec ((SV *)term->self); |
569 | SvREFCNT_dec ((SV *)term->perl.self); |
574 | } |
570 | } |
575 | |
571 | |
576 | return count; |
572 | return count; |
577 | } |
573 | } |
578 | |
574 | |
… | |
… | |
588 | |
584 | |
589 | PROTOTYPES: ENABLE |
585 | PROTOTYPES: ENABLE |
590 | |
586 | |
591 | BOOT: |
587 | BOOT: |
592 | { |
588 | { |
|
|
589 | HV *stash = gv_stashpv ("urxvt", 1); |
593 | # define export_const(name) newCONSTSUB (gv_stashpv ("urxvt", 1), # name, newSViv (name)); |
590 | # define export_const_iv(name) newCONSTSUB (stash, # name, newSViv (name)); |
|
|
591 | |
594 | AV *hookname = get_av ("urxvt::HOOKNAME", 1); |
592 | AV *hookname = get_av ("urxvt::HOOKNAME", 1); |
595 | # define def(sym) av_store (hookname, HOOK_ ## sym, newSVpv (# sym, 0)); |
593 | # define def(sym) av_store (hookname, HOOK_ ## sym, newSVpv (# sym, 0)); |
596 | # include "hookinc.h" |
594 | # include "hookinc.h" |
597 | # undef def |
595 | # undef def |
598 | |
596 | |
|
|
597 | |
599 | export_const (DEFAULT_RSTYLE); |
598 | export_const_iv (DEFAULT_RSTYLE); |
600 | export_const (OVERLAY_RSTYLE); |
599 | export_const_iv (OVERLAY_RSTYLE); |
601 | export_const (RS_Bold); |
600 | export_const_iv (RS_Bold); |
602 | export_const (RS_Italic); |
601 | export_const_iv (RS_Italic); |
603 | export_const (RS_Blink); |
602 | export_const_iv (RS_Blink); |
604 | export_const (RS_RVid); |
603 | export_const_iv (RS_RVid); |
605 | export_const (RS_Uline); |
604 | export_const_iv (RS_Uline); |
606 | |
605 | |
607 | sv_setpv (get_sv ("urxvt::LIBDIR", 1), LIBDIR); |
606 | export_const_iv (CurrentTime); |
|
|
607 | export_const_iv (ShiftMask); |
|
|
608 | export_const_iv (LockMask); |
|
|
609 | export_const_iv (ControlMask); |
|
|
610 | export_const_iv (Mod1Mask); |
|
|
611 | export_const_iv (Mod2Mask); |
|
|
612 | export_const_iv (Mod3Mask); |
|
|
613 | export_const_iv (Mod4Mask); |
|
|
614 | export_const_iv (Mod5Mask); |
|
|
615 | export_const_iv (Button1Mask); |
|
|
616 | export_const_iv (Button2Mask); |
|
|
617 | export_const_iv (Button3Mask); |
|
|
618 | export_const_iv (Button4Mask); |
|
|
619 | export_const_iv (Button5Mask); |
|
|
620 | export_const_iv (AnyModifier); |
|
|
621 | |
|
|
622 | sv_setsv (get_sv ("urxvt::LIBDIR", 1), newSVpvn (LIBDIR, sizeof (LIBDIR) - 1)); |
608 | } |
623 | } |
609 | |
624 | |
610 | SV * |
625 | SV * |
611 | new (...) |
626 | new (...) |
612 | CODE: |
627 | CODE: |
… | |
… | |
630 | { |
645 | { |
631 | term->destroy (); |
646 | term->destroy (); |
632 | croak ("exception caught while initializing new terminal instance"); |
647 | croak ("exception caught while initializing new terminal instance"); |
633 | } |
648 | } |
634 | |
649 | |
635 | RETVAL = term && term->self ? newSVterm (term) : &PL_sv_undef; |
650 | RETVAL = term && term->perl.self ? newSVterm (term) : &PL_sv_undef; |
636 | } |
651 | } |
637 | OUTPUT: |
652 | OUTPUT: |
638 | RETVAL |
653 | RETVAL |
639 | |
654 | |
640 | void |
655 | void |
… | |
… | |
709 | |
724 | |
710 | MODULE = urxvt PACKAGE = urxvt::term |
725 | MODULE = urxvt PACKAGE = urxvt::term |
711 | |
726 | |
712 | void |
727 | void |
713 | rxvt_term::destroy () |
728 | rxvt_term::destroy () |
|
|
729 | |
|
|
730 | void |
|
|
731 | rxvt_term::grab_button (int button, U32 modifiers) |
|
|
732 | CODE: |
|
|
733 | XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1, |
|
|
734 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
|
|
735 | GrabModeSync, GrabModeSync, None, None); |
|
|
736 | |
|
|
737 | bool |
|
|
738 | rxvt_term::grab (U32 eventtime, int sync = 0) |
|
|
739 | CODE: |
|
|
740 | { |
|
|
741 | int mode = sync ? GrabModeSync : GrabModeAsync; |
|
|
742 | |
|
|
743 | THIS->perl.grabtime = 0; |
|
|
744 | |
|
|
745 | if (!XGrabPointer (THIS->display->display, THIS->vt, 0, |
|
|
746 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
|
|
747 | mode, mode, None, None, eventtime)) |
|
|
748 | if (!XGrabKeyboard (THIS->display->display, THIS->vt, 0, mode, mode, eventtime)) |
|
|
749 | THIS->perl.grabtime = eventtime; |
|
|
750 | else |
|
|
751 | XUngrabPointer (THIS->display->display, eventtime); |
|
|
752 | |
|
|
753 | RETVAL = !!THIS->perl.grabtime; |
|
|
754 | } |
|
|
755 | OUTPUT: |
|
|
756 | RETVAL |
|
|
757 | |
|
|
758 | void |
|
|
759 | rxvt_term::allow_events_async (U32 eventtime = THIS->perl.grabtime) |
|
|
760 | CODE: |
|
|
761 | XAllowEvents (THIS->display->display, AsyncBoth, eventtime); |
|
|
762 | |
|
|
763 | void |
|
|
764 | rxvt_term::allow_events_sync (U32 eventtime = THIS->perl.grabtime) |
|
|
765 | CODE: |
|
|
766 | XAllowEvents (THIS->display->display, SyncBoth, eventtime); |
|
|
767 | |
|
|
768 | void |
|
|
769 | rxvt_term::allow_events_replay (U32 eventtime = THIS->perl.grabtime) |
|
|
770 | CODE: |
|
|
771 | XAllowEvents (THIS->display->display, ReplayPointer, eventtime); |
|
|
772 | XAllowEvents (THIS->display->display, ReplayKeyboard, eventtime); |
|
|
773 | |
|
|
774 | void |
|
|
775 | rxvt_term::ungrab (U32 eventtime = THIS->perl.grabtime) |
|
|
776 | CODE: |
|
|
777 | THIS->perl.grabtime = 0; |
|
|
778 | XUngrabKeyboard (THIS->display->display, eventtime); |
|
|
779 | XUngrabPointer (THIS->display->display, eventtime); |
714 | |
780 | |
715 | int |
781 | int |
716 | rxvt_term::strwidth (SV *str) |
782 | rxvt_term::strwidth (SV *str) |
717 | CODE: |
783 | CODE: |
718 | { |
784 | { |
… | |
… | |
760 | free (wstr); |
826 | free (wstr); |
761 | } |
827 | } |
762 | OUTPUT: |
828 | OUTPUT: |
763 | RETVAL |
829 | RETVAL |
764 | |
830 | |
765 | # very portable, especially on objects as opposed to pods |
831 | #define TERM_OFFSET(sym) offsetof (TermWin_t, sym) |
766 | #define TERM_OFFSET(sym) (((char *)&((TermWin_t *)0)->sym) - (char *)(TermWin_t *)0) |
|
|
767 | |
832 | |
768 | #define TERM_OFFSET_width TERM_OFFSET(width) |
833 | #define TERM_OFFSET_width TERM_OFFSET(width) |
769 | #define TERM_OFFSET_height TERM_OFFSET(height) |
834 | #define TERM_OFFSET_height TERM_OFFSET(height) |
770 | #define TERM_OFFSET_fwidth TERM_OFFSET(fwidth) |
835 | #define TERM_OFFSET_fwidth TERM_OFFSET(fwidth) |
771 | #define TERM_OFFSET_fheight TERM_OFFSET(fheight) |
836 | #define TERM_OFFSET_fheight TERM_OFFSET(fheight) |
… | |
… | |
796 | CODE: |
861 | CODE: |
797 | RETVAL = *(int *)((char *)THIS + ix); |
862 | RETVAL = *(int *)((char *)THIS + ix); |
798 | OUTPUT: |
863 | OUTPUT: |
799 | RETVAL |
864 | RETVAL |
800 | |
865 | |
|
|
866 | unsigned int |
|
|
867 | rxvt_term::ModLevel3Mask () |
|
|
868 | ALIAS: |
|
|
869 | ModLevel3Mask = 0 |
|
|
870 | ModMetaMask = 1 |
|
|
871 | ModNumLockMask = 2 |
|
|
872 | CODE: |
|
|
873 | switch (ix) |
|
|
874 | { |
|
|
875 | case 0: RETVAL = THIS->ModLevel3Mask; break; |
|
|
876 | case 1: RETVAL = THIS->ModMetaMask; break; |
|
|
877 | case 2: RETVAL = THIS->ModNumLockMask; break; |
|
|
878 | } |
|
|
879 | OUTPUT: |
|
|
880 | RETVAL |
|
|
881 | |
801 | U32 |
882 | U32 |
802 | rxvt_term::parent () |
883 | rxvt_term::parent () |
803 | CODE: |
884 | CODE: |
804 | RETVAL = (U32)THIS->parent [0]; |
885 | RETVAL = (U32)THIS->parent [0]; |
805 | OUTPUT: |
886 | OUTPUT: |
… | |
… | |
853 | |
934 | |
854 | if (GIMME_V != G_VOID) |
935 | if (GIMME_V != G_VOID) |
855 | { |
936 | { |
856 | wchar_t *wstr = new wchar_t [THIS->ncol]; |
937 | wchar_t *wstr = new wchar_t [THIS->ncol]; |
857 | |
938 | |
858 | for (int col = 0; col <THIS->ncol; col++) |
939 | for (int col = 0; col < THIS->ncol; col++) |
859 | wstr [col] = l.t [col]; |
940 | wstr [col] = l.t [col]; |
860 | |
941 | |
861 | XPUSHs (sv_2mortal (wcs2sv (wstr))); |
942 | XPUSHs (sv_2mortal (wcs2sv (wstr, THIS->ncol))); |
862 | |
943 | |
863 | delete [] wstr; |
944 | delete [] wstr; |
864 | } |
945 | } |
865 | |
946 | |
866 | if (new_text) |
947 | if (new_text) |
… | |
… | |
956 | } |
1037 | } |
957 | OUTPUT: |
1038 | OUTPUT: |
958 | RETVAL |
1039 | RETVAL |
959 | |
1040 | |
960 | SV * |
1041 | SV * |
961 | rxvt_term::special_encode (SV *str) |
1042 | rxvt_term::special_encode (SV *string) |
962 | CODE: |
1043 | CODE: |
963 | abort ();//TODO |
1044 | { |
|
|
1045 | wchar_t *wstr = sv2wcs (string); |
|
|
1046 | int wlen = wcslen (wstr); |
|
|
1047 | wchar_t *rstr = new wchar_t [wlen]; // cannot become longer |
|
|
1048 | |
|
|
1049 | rxvt_push_locale (THIS->locale); |
|
|
1050 | |
|
|
1051 | wchar_t *r = rstr; |
|
|
1052 | for (wchar_t *s = wstr; *s; s++) |
|
|
1053 | if (wcwidth (*s) == 0) |
|
|
1054 | { |
|
|
1055 | if (r == rstr) |
|
|
1056 | croak ("leading combining character unencodable"); |
|
|
1057 | |
|
|
1058 | unicode_t n = rxvt_compose (r[-1], *s); |
|
|
1059 | if (n == NOCHAR) |
|
|
1060 | n = rxvt_composite.compose (r[-1], *s); |
|
|
1061 | |
|
|
1062 | r[-1] = n; |
|
|
1063 | } |
|
|
1064 | #if !UNICODE_3 |
|
|
1065 | else if (*s >= 0x10000) |
|
|
1066 | *r++ = rxvt_composite.compose (*s); |
|
|
1067 | #endif |
|
|
1068 | else |
|
|
1069 | *r++ = *s; |
|
|
1070 | |
|
|
1071 | rxvt_pop_locale (); |
|
|
1072 | |
|
|
1073 | RETVAL = wcs2sv (rstr, r - rstr); |
|
|
1074 | |
|
|
1075 | delete [] rstr; |
|
|
1076 | } |
|
|
1077 | OUTPUT: |
|
|
1078 | RETVAL |
964 | |
1079 | |
965 | SV * |
1080 | SV * |
966 | rxvt_term::special_decode (SV *str) |
1081 | rxvt_term::special_decode (SV *text) |
967 | CODE: |
1082 | CODE: |
968 | abort ();//TODO |
1083 | { |
|
|
1084 | wchar_t *wstr = sv2wcs (text); |
|
|
1085 | int wlen = wcslen (wstr); |
|
|
1086 | int dlen = 0; |
|
|
1087 | |
|
|
1088 | // find length |
|
|
1089 | for (wchar_t *s = wstr; *s; s++) |
|
|
1090 | if (*s == NOCHAR) |
|
|
1091 | ; |
|
|
1092 | else if (IS_COMPOSE (*s)) |
|
|
1093 | dlen += rxvt_composite.expand (*s, 0); |
|
|
1094 | else |
|
|
1095 | dlen++; |
|
|
1096 | |
|
|
1097 | wchar_t *rstr = new wchar_t [dlen]; |
|
|
1098 | |
|
|
1099 | // decode |
|
|
1100 | wchar_t *r = rstr; |
|
|
1101 | for (wchar_t *s = wstr; *s; s++) |
|
|
1102 | if (*s == NOCHAR) |
|
|
1103 | ; |
|
|
1104 | else if (IS_COMPOSE (*s)) |
|
|
1105 | r += rxvt_composite.expand (*s, r); |
|
|
1106 | else |
|
|
1107 | *r++ = *s; |
|
|
1108 | |
|
|
1109 | RETVAL = wcs2sv (rstr, r - rstr); |
|
|
1110 | |
|
|
1111 | delete [] rstr; |
|
|
1112 | } |
|
|
1113 | OUTPUT: |
|
|
1114 | RETVAL |
969 | |
1115 | |
970 | void |
1116 | void |
971 | rxvt_term::_resource (char *name, int index, SV *newval = 0) |
1117 | rxvt_term::_resource (char *name, int index, SV *newval = 0) |
972 | PPCODE: |
1118 | PPCODE: |
973 | { |
1119 | { |
… | |
… | |
1038 | THIS->want_refresh = 1; |
1184 | THIS->want_refresh = 1; |
1039 | } |
1185 | } |
1040 | } |
1186 | } |
1041 | |
1187 | |
1042 | int |
1188 | int |
1043 | rxvt_term::selection_grab (int eventtime = CurrentTime) |
1189 | rxvt_term::selection_grab (U32 eventtime) |
1044 | |
1190 | |
1045 | void |
1191 | void |
1046 | rxvt_term::selection (SV *newtext = 0) |
1192 | rxvt_term::selection (SV *newtext = 0) |
1047 | PPCODE: |
1193 | PPCODE: |
1048 | { |
1194 | { |
… | |
… | |
1061 | void |
1207 | void |
1062 | rxvt_term::scr_add_lines (SV *string) |
1208 | rxvt_term::scr_add_lines (SV *string) |
1063 | CODE: |
1209 | CODE: |
1064 | { |
1210 | { |
1065 | wchar_t *wstr = sv2wcs (string); |
1211 | wchar_t *wstr = sv2wcs (string); |
1066 | int wlen = wcslen (wstr); |
|
|
1067 | unicode_t *ustr = new unicode_t [wlen]; |
|
|
1068 | int nlines = 0; |
|
|
1069 | |
|
|
1070 | for (int i = wlen; i--; ) |
|
|
1071 | { |
|
|
1072 | ustr [i] = wstr [i]; |
|
|
1073 | nlines += ustr [i] == '\012'; |
|
|
1074 | } |
|
|
1075 | |
|
|
1076 | THIS->scr_add_lines (ustr, nlines, wlen); |
1212 | THIS->scr_add_lines (wstr, wcslen (wstr)); |
1077 | |
|
|
1078 | free (wstr); |
1213 | free (wstr); |
1079 | delete [] ustr; |
|
|
1080 | } |
1214 | } |
1081 | |
1215 | |
1082 | void |
1216 | void |
1083 | rxvt_term::tt_write (SV *octets) |
1217 | rxvt_term::tt_write (SV *octets) |
1084 | INIT: |
1218 | INIT: |
… | |
… | |
1098 | char *old_cmdbuf_endp = THIS->cmdbuf_endp; |
1232 | char *old_cmdbuf_endp = THIS->cmdbuf_endp; |
1099 | |
1233 | |
1100 | THIS->cmdbuf_ptr = str; |
1234 | THIS->cmdbuf_ptr = str; |
1101 | THIS->cmdbuf_endp = str + len; |
1235 | THIS->cmdbuf_endp = str + len; |
1102 | |
1236 | |
|
|
1237 | rxvt_push_locale (THIS->locale); |
1103 | THIS->cmd_parse (); |
1238 | THIS->cmd_parse (); |
|
|
1239 | rxvt_pop_locale (); |
1104 | |
1240 | |
1105 | THIS->cmdbuf_ptr = old_cmdbuf_ptr; |
1241 | THIS->cmdbuf_ptr = old_cmdbuf_ptr; |
1106 | THIS->cmdbuf_endp = old_cmdbuf_endp; |
1242 | THIS->cmdbuf_endp = old_cmdbuf_endp; |
1107 | } |
1243 | } |
1108 | |
1244 | |