From: root Date: Fri, 6 Jan 2006 20:50:58 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=7c912f981ef4a54598824870725d1239e46a81f0;p=dana%2Furxvt.git *** empty log message *** --- diff --git a/doc/rxvt.1.pod b/doc/rxvt.1.pod index b057d530..56ebba25 100644 --- a/doc/rxvt.1.pod +++ b/doc/rxvt.1.pod @@ -468,7 +468,7 @@ longer example is in F): =item B<-pe> I -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. =back @@ -1086,7 +1086,7 @@ info): =item B: I -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 diff --git a/src/keyboard.C b/src/keyboard.C index 14bf78c8..701d56d4 100644 --- a/src/keyboard.C +++ b/src/keyboard.C @@ -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)); } diff --git a/src/misc.C b/src/misc.C index dfc9f9db..ff96ed3c 100644 --- a/src/misc.C +++ b/src/misc.C @@ -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 diff --git a/src/perl/selection b/src/perl/selection index 730dcd1e..31a25383 100644 --- a/src/perl/selection +++ b/src/perl/selection @@ -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) = @_; diff --git a/src/rxvt.h b/src/rxvt.h index ca199e5a..c0152f41 100644 --- a/src/rxvt.h +++ b/src/rxvt.h @@ -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 diff --git a/src/rxvtperl.xs b/src/rxvtperl.xs index efd63c5c..ffed0dd2 100644 --- a/src/rxvtperl.xs +++ b/src/rxvtperl.xs @@ -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 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) diff --git a/src/urxvt.pm b/src/urxvt.pm index 0027a016..d067439c 100644 --- a/src/urxvt.pm +++ b/src/urxvt.pm @@ -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) {