=item B<-pe> I<string>
-Colon-separated list of perl extension scripts to use in this terminal
+Comma-separated list of perl extension scripts to use in this terminal
instance. See resource B<perl-ext>.
=back
=item B<perl-ext>: I<string>
-Colon-separated list(s) of perl extension scripts to use in this terminal
+Comma-separated list(s) of perl extension scripts to use in this terminal
instance. Each extension is looked up in the library directories, loaded
if necessary, and bound to the current terminal instance. If this
resource is empty or missing, then the perl interpreter will not be
if (strncmp (str, "command:", 8) == 0)
rt->cmd_write (str + 8, strlen (str) - 8);
else if (strncmp (str, "perl:", 5) == 0)
- HOOK_INVOKE((rt, HOOK_KEYBOARD_COMMAND, DT_STRING, str + 5, DT_END));
+ HOOK_INVOKE((rt, HOOK_KEYBOARD_COMMAND, DT_STR, str + 5, DT_END));
else
rt->tt_write (str, strlen (str));
}
while (len--)
{
ssize_t l = wcrtomb (dst, *str++, mbs);
+
if (l < 0)
*dst++ = '?';
else
[ab-zA-Z0-9\-\@;\/?:&=%\$_+!*\x27(),~] # do not include a trailing dot, its wrong too often
)}x,
+ # common forms of quoting
+ qr{(?:^|\s) [‘`] ([^‘`’']+) [’'] (?:\s|$)}x,
+
# shell-like argument quoting
qr{\G [\ \t|&;<>()] *(
(?:
| " (?: [^\\"]+ | \\. )* "
| ' [^']* '
)+
- )}xs,
+ )}x,
);
+my $x = "‘hallole’";
+
sub on_sel_extend {
my ($self) = @_;
# define COMPOSE_HI 0x400fffffUL
# define IS_COMPOSE(n) ((int32_t)(n) >= COMPOSE_LO)
#else
-# define COMPOSE_LO 0xd800UL
-# define COMPOSE_HI 0xf8ffUL // dfff should be safer, but...
-# define IS_COMPOSE(n) (COMPOSE_LO <= (n) && (n) <= COMPOSE_HI)
+# if ENABLE_PERL
+# define COMPOSE_LO 0xe000UL // our _own_ routiens don't like (illegal) surrogates
+# define COMPOSE_HI 0xf8ffUL // in utf-8, so use private use area only
+# else
+# define COMPOSE_LO 0xd800UL
+# define COMPOSE_HI 0xf8ffUL
+# endif
+# define IS_COMPOSE(n) IN_RANGE_INC ((n), COMPOSE_LO, COMPOSE_HI)
#endif
#if ENABLE_COMBINING
{
wchar_t *wstr = new wchar_t [THIS->ncol];
- for (int col = 0; col <THIS->ncol; col++)
+ for (int col = 0; col < THIS->ncol; col++)
wstr [col] = l.t [col];
- XPUSHs (sv_2mortal (wcs2sv (wstr)));
+ XPUSHs (sv_2mortal (wcs2sv (wstr, THIS->ncol)));
delete [] wstr;
}
RETVAL
SV *
-rxvt_term::special_encode (SV *str)
+rxvt_term::special_encode (SV *string)
CODE:
- abort ();//TODO
+{
+ wchar_t *wstr = sv2wcs (string);
+ int wlen = wcslen (wstr);
+ wchar_t *rstr = new wchar_t [wlen]; // cannot become longer
+
+ rxvt_push_locale (THIS->locale);
+
+ wchar_t *r = rstr;
+ for (wchar_t *s = wstr; *s; s++)
+ if (wcwidth (*s) == 0)
+ {
+ if (r == rstr)
+ croak ("leading combining character unencodable");
+
+ unicode_t n = rxvt_compose (r[-1], *s);
+ if (n == NOCHAR)
+ n = rxvt_composite.compose (r[-1], *s);
+
+ r[-1] = n;
+ }
+#if !UNICODE_3
+ else if (*s >= 0x10000)
+ *r++ = rxvt_composite.compose (*s);
+#endif
+ else
+ *r++ = *s;
+
+ rxvt_pop_locale ();
+
+ RETVAL = wcs2sv (rstr, r - rstr);
+
+ delete [] rstr;
+}
+ OUTPUT:
+ RETVAL
SV *
-rxvt_term::special_decode (SV *str)
+rxvt_term::special_decode (SV *text)
CODE:
- abort ();//TODO
+{
+ wchar_t *wstr = sv2wcs (text);
+ int wlen = wcslen (wstr);
+ int dlen = 0;
+
+ // find length
+ for (wchar_t *s = wstr; *s; s++)
+ if (*s == NOCHAR)
+ ;
+ else if (IS_COMPOSE (*s))
+ dlen += rxvt_composite.expand (*s, 0);
+ else
+ dlen++;
+
+ wchar_t *rstr = new wchar_t [dlen];
+
+ // decode
+ wchar_t *r = rstr;
+ for (wchar_t *s = wstr; *s; s++)
+ if (*s == NOCHAR)
+ ;
+ else if (IS_COMPOSE (*s))
+ r += rxvt_composite.expand (*s, r);
+ else
+ *r++ = *s;
+
+ RETVAL = wcs2sv (rstr, r - rstr);
+
+ delete [] rstr;
+}
+ OUTPUT:
+ RETVAL
void
rxvt_term::_resource (char *name, int index, SV *newval = 0)
if ($htype == 0) { # INIT
my @dirs = ((split /:/, $TERM->resource ("perl_lib")), "$LIBDIR/perl");
- for my $ext (map { split /:/, $TERM->resource ("perl_ext_$_") } 1, 2) {
+ for my $ext (map { split /,/, $TERM->resource ("perl_ext_$_") } 1, 2) {
my @files = grep -f $_, map "$_/$ext", @dirs;
if (@files) {