*** empty log message ***
authorroot <root>
Fri, 6 Jan 2006 20:50:58 +0000 (20:50 +0000)
committerroot <root>
Fri, 6 Jan 2006 20:50:58 +0000 (20:50 +0000)
doc/rxvt.1.pod
src/keyboard.C
src/misc.C
src/perl/selection
src/rxvt.h
src/rxvtperl.xs
src/urxvt.pm

index b057d530bf60de9587c5f81b254e632dbb81b167..56ebba251c43801cb1098ca81529f4dcf5f5199e 100644 (file)
@@ -468,7 +468,7 @@ longer example is in F<doc/pty-fd>):
 
 =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
@@ -1086,7 +1086,7 @@ info):
 
 =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
index 14bf78c875a061fff2aa024dccdd655c3f610862..701d56d473fea05091207c4fef57208fadbf7167 100644 (file)
@@ -76,7 +76,7 @@ output_string (rxvt_term *rt, const char *str)
   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));
 }
index dfc9f9db6988b54ce2a336ab3125164ebef86371..ff96ed3c459af9a8ab41e9c20f490b018d00c93b 100644 (file)
@@ -38,6 +38,7 @@ rxvt_wcstombs (const wchar_t *str, int len)
   while (len--)
     {
       ssize_t l = wcrtomb (dst, *str++, mbs);
+
       if (l < 0)
         *dst++ = '?';
       else
index 730dcd1e4de6528e4ec93b5bfc2944f547a076fe..31a253832f11377f398b7ff9ddaa01fd9ab5c54a 100644 (file)
@@ -16,6 +16,9 @@ my @patterns = (
       [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|&;<>()] *(
       (?:
@@ -24,9 +27,11 @@ my @patterns = (
          | " (?: [^\\"]+ | \\. )* "
          | ' [^']* '
       )+
-   )}xs,
+   )}x,
 );
 
+my $x = "‘hallole’";
+
 sub on_sel_extend {
    my ($self) = @_;
 
index ca199e5ae0028a52dd3d32ab2fd9b29b740f0308..c0152f41b4341e5e16efe4f4b0263d79e2e88284 100644 (file)
@@ -922,9 +922,14 @@ struct mbstate {
 # 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
index efd63c5c2ece9ac5699da09941f8620c13e1c385..ffed0dd279b81cd2c8847d846f2c748e834e9a63 100644 (file)
@@ -849,10 +849,10 @@ rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0, int start
           {
             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;
           }
@@ -952,14 +952,79 @@ rxvt_term::ROW_is_longer (int row_number, int new_is_longer = -1)
         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)
index 0027a01640526446cce67e4f006dc67ab7b35f9c..d067439c5e2b20b07ea430834e42a819e8813d66 100644 (file)
@@ -467,7 +467,7 @@ sub invoke {
    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) {