From 6d7a00a4a9ca5c7daaf7b29df91c7198e4c7e9eb Mon Sep 17 00:00:00 2001 From: root Date: Mon, 16 Jan 2006 06:37:51 +0000 Subject: [PATCH] *** empty log message *** --- Changes | 3 +++ doc/rxvtperl.3.html | 28 ++++++++++++++-------------- doc/rxvtperl.3.man.in | 12 ++++++------ doc/rxvtperl.3.txt | 24 ++++++++++++------------ src/command.C | 20 +++++++------------- src/main.C | 15 +++++++++++---- src/rxvt.h | 18 ++++++++++-------- src/rxvtlib.h.in | 2 +- src/screen.C | 4 ++-- 9 files changed, 66 insertions(+), 60 deletions(-) diff --git a/Changes b/Changes index b92a40ea..d59c1f07 100644 --- a/Changes +++ b/Changes @@ -14,6 +14,9 @@ WISH: support tex fonts 9.0 - use the scrollback buffer even when the scroll region doesn't span the whole screen, as long as it starts at row 0. + - swap the environment in some more cases. This hopefully fixes + some segfaults that might be caused by xft asking for env variables + at the wrong time. - selection popup now shows selection in dec/hex/oct. - perl/selection: matching on unicode characters in the selection code was O(n²), which equals infinity in some degenerate cases diff --git a/doc/rxvtperl.3.html b/doc/rxvtperl.3.html index 841984cb..658bbd48 100644 --- a/doc/rxvtperl.3.html +++ b/doc/rxvtperl.3.html @@ -1,7 +1,7 @@ -urxvtperl - rxvt-unicode's embedded perl interpreter +rxvtperl - rxvt-unicode's embedded perl interpreter @@ -47,7 +47,7 @@


NAME

-

urxvtperl - rxvt-unicode's embedded perl interpreter

+

rxvtperl - rxvt-unicode's embedded perl interpreter


@@ -60,9 +60,9 @@ () }
-   # start a urxvt using it:
+ # start a rxvt using it:
-   urxvt --perl-lib $HOME -pe grab_test
+ rxvt --perl-lib $HOME -pe grab_test


@@ -71,17 +71,17 @@ the perl resource are loaded and associated with it.

Scripts are compiled in a 'use strict' and 'use utf8' environment, and thus must be encoded as UTF-8.

-

Each script will only ever be loaded once, even in urxvtd, where +

Each script will only ever be loaded once, even in rxvtd, where scripts will be shared (but not enabled) for all terminals.


PREPACKAGED EXTENSIONS

This section describes the extensions delivered with this release. You can -find them in /usr/local/lib/urxvt/perl/.

+find them in /opt/rxvt/lib/urxvt/perl/.

You can activate them like this:

-  urxvt -pe <extensionname>
+ rxvt -pe <extensionname>
selection (enabled by default)
@@ -491,7 +491,7 @@ Called just after the screen gets redrawn. See on_refresh_begin.
Called whenever the user presses a key combination that has a perl:string action bound to it (see description of the keysym -resource in the urxvt(1) manpage). +resource in the rxvt(1) manpage).

on_x_event $term, $event
@@ -737,7 +737,7 @@ initialise perl, and the terminal object otherwise. The init and
Destroy the terminal object (close the window, free resources -etc.). Please note that urxvt will not exit as long as any event +etc.). Please note that rxvt will not exit as long as any event watchers (timers, io watchers) are still active.

@@ -822,7 +822,7 @@ the wrong resources.

Adds a keymap translation exactly as specified via a resource. See the -keysym resource in the urxvt(1) manpage. +keysym resource in the rxvt(1) manpage.

$rend = $term->rstyle ([$new_rstyle])
@@ -1056,7 +1056,7 @@ to receive pointer events all the times:
$nrow_plus_saveLines = $term->total_rows
-
$lines_in_scrollback = $term->nsaved
+
$topmost_scrollback_row = $term->top_row
Return various integers describing terminal characteristics. @@ -1095,8 +1095,8 @@ AltGr), the meta key (often Alt) and the num lock key, if applicable.
$view_start = $term->view_start ([$newvalue])
-Returns the negative row number of the topmost line. Minimum value is -0, which displays the normal terminal contents. Larger values scroll +Returns the row number of the topmost displayed line. Maximum value is +0, which displays the normal terminal contents. Lower values scroll this many lines into the scrollback buffer.

@@ -1117,7 +1117,7 @@ differ, it redraws the differences. Returns the text of the entire row with number $row_number. Row 0 is the topmost terminal line, row $term->$ncol-1 is the bottommost terminal line. The scrollback buffer starts at line -1 and extends to -line -$term->nsaved. Nothing will be returned if a nonexistent line +line -$term->nsaved. Nothing will be returned if a nonexistent line is requested.
diff --git a/doc/rxvtperl.3.man.in b/doc/rxvtperl.3.man.in index 48ebd258..d1a5f461 100644 --- a/doc/rxvtperl.3.man.in +++ b/doc/rxvtperl.3.man.in @@ -129,7 +129,7 @@ .\" ======================================================================== .\" .IX Title "rxvt 3" -.TH rxvt 3 "2006-01-13" "7.0" "RXVT-UNICODE" +.TH rxvt 3 "2006-01-15" "7.0" "RXVT-UNICODE" .SH "NAME" @@RXVT_NAME@@perl \- rxvt\-unicode's embedded perl interpreter .SH "SYNOPSIS" @@ -936,9 +936,9 @@ to receive pointer events all the times: .ie n .IP "$nrow_plus_saveLines = $term\->total_rows" 4 .el .IP "$nrow_plus_saveLines = \f(CW$term\fR\->total_rows" 4 .IX Item "$nrow_plus_saveLines = $term->total_rows" -.ie n .IP "$lines_in_scrollback = $term\->nsaved" 4 -.el .IP "$lines_in_scrollback = \f(CW$term\fR\->nsaved" 4 -.IX Item "$lines_in_scrollback = $term->nsaved" +.ie n .IP "$topmost_scrollback_row = $term\->top_row" 4 +.el .IP "$topmost_scrollback_row = \f(CW$term\fR\->top_row" 4 +.IX Item "$topmost_scrollback_row = $term->top_row" .PD Return various integers describing terminal characteristics. .ie n .IP "$x_display = $term\->display_id" 4 @@ -970,8 +970,8 @@ AltGr), the meta key (often Alt) and the num lock key, if applicable. .ie n .IP "$view_start = $term\->view_start ([$newvalue])" 4 .el .IP "$view_start = \f(CW$term\fR\->view_start ([$newvalue])" 4 .IX Item "$view_start = $term->view_start ([$newvalue])" -Returns the negative row number of the topmost line. Minimum value is -\&\f(CW0\fR, which displays the normal terminal contents. Larger values scroll +Returns the row number of the topmost displayed line. Maximum value is +\&\f(CW0\fR, which displays the normal terminal contents. Lower values scroll this many lines into the scrollback buffer. .IP "$term\->want_refresh" 4 .IX Item "$term->want_refresh" diff --git a/doc/rxvtperl.3.txt b/doc/rxvtperl.3.txt index 137eea04..d36bf8c9 100644 --- a/doc/rxvtperl.3.txt +++ b/doc/rxvtperl.3.txt @@ -1,5 +1,5 @@ NAME - urxvtperl - rxvt-unicode's embedded perl interpreter + rxvtperl - rxvt-unicode's embedded perl interpreter SYNOPSIS # create a file grab_test in $HOME: @@ -9,9 +9,9 @@ SYNOPSIS () } - # start a urxvt using it: + # start a rxvt using it: - urxvt --perl-lib $HOME -pe grab_test + rxvt --perl-lib $HOME -pe grab_test DESCRIPTION Everytime a terminal object gets created, extension scripts specified @@ -20,16 +20,16 @@ DESCRIPTION Scripts are compiled in a 'use strict' and 'use utf8' environment, and thus must be encoded as UTF-8. - Each script will only ever be loaded once, even in urxvtd, where scripts + Each script will only ever be loaded once, even in rxvtd, where scripts will be shared (but not enabled) for all terminals. PREPACKAGED EXTENSIONS This section describes the extensions delivered with this release. You - can find them in /usr/local/lib/urxvt/perl/. + can find them in /opt/rxvt/lib/urxvt/perl/. You can activate them like this: - urxvt -pe + rxvt -pe selection (enabled by default) (More) intelligent selection. This extension tries to be more @@ -320,7 +320,7 @@ API DOCUMENTATION on_keyboard_command $term, $string Called whenever the user presses a key combination that has a "perl:string" action bound to it (see description of the keysym - resource in the urxvt(1) manpage). + resource in the rxvt(1) manpage). on_x_event $term, $event Called on every X event received on the vt window (and possibly @@ -476,7 +476,7 @@ API DOCUMENTATION $term->destroy Destroy the terminal object (close the window, free resources etc.). - Please note that urxvt will not exit as long as any event watchers + Please note that rxvt will not exit as long as any event watchers (timers, io watchers) are still active. $isset = $term->option ($optval[, $set]) @@ -541,7 +541,7 @@ API DOCUMENTATION $success = $term->parse_keysym ($keysym_spec, $command_string) Adds a keymap translation exactly as specified via a resource. See - the "keysym" resource in the urxvt(1) manpage. + the "keysym" resource in the rxvt(1) manpage. $rend = $term->rstyle ([$new_rstyle]) Return and optionally change the current rendition. Text that is @@ -688,7 +688,7 @@ API DOCUMENTATION $is_mapped = $term->mapped $max_scrollback = $term->saveLines $nrow_plus_saveLines = $term->total_rows - $lines_in_scrollback = $term->nsaved + $topmost_scrollback_row = $term->top_row Return various integers describing terminal characteristics. $x_display = $term->display_id @@ -709,8 +709,8 @@ API DOCUMENTATION applicable. $view_start = $term->view_start ([$newvalue]) - Returns the negative row number of the topmost line. Minimum value - is 0, which displays the normal terminal contents. Larger values + Returns the row number of the topmost displayed line. Maximum value + is 0, which displays the normal terminal contents. Lower values scroll this many lines into the scrollback buffer. $term->want_refresh diff --git a/src/command.C b/src/command.C index f2d77bd8..75882ce0 100644 --- a/src/command.C +++ b/src/command.C @@ -1023,8 +1023,7 @@ rxvt_term::flush () void rxvt_term::check_cb (check_watcher &w) { - SET_R (this); - SET_LOCALE (locale); + make_current (); display->flush (); @@ -1035,8 +1034,7 @@ rxvt_term::check_cb (check_watcher &w) void rxvt_term::flush_cb (time_watcher &w) { - SET_R (this); - SET_LOCALE (locale); + make_current (); refresh_limit = 1; refresh_count = 0; @@ -1174,8 +1172,7 @@ rxvt_term::pty_fill () void rxvt_term::pty_cb (io_watcher &w, short revents) { - SET_R (this); - SET_LOCALE (locale); + make_current (); if (revents & EVENT_READ) // loop, but don't allow a single term to monopolize us @@ -1217,8 +1214,7 @@ rxvt_term::pointer_blank () void rxvt_term::pointer_cb (time_watcher &w) { - SET_R (this); - SET_LOCALE (locale); + make_current (); pointer_blank (); } @@ -1307,10 +1303,9 @@ rxvt_W11_process_x_event (XEvent *ev) void rxvt_term::x_cb (XEvent &ev) { - dDisp; + make_current (); - SET_R (this); - SET_LOCALE (locale); + dDisp; if (ev.xany.window == vt && HOOK_INVOKE ((this, HOOK_X_EVENT, DT_XEVENT, &ev, DT_END))) @@ -1824,8 +1819,7 @@ rxvt_term::focus_out () void rxvt_term::rootwin_cb (XEvent &ev) { - SET_R (this); - SET_LOCALE (locale); + make_current (); switch (ev.type) { diff --git a/src/main.C b/src/main.C index e91fb839..ae3210b3 100644 --- a/src/main.C +++ b/src/main.C @@ -91,6 +91,14 @@ rxvt_pop_locale () rxvt_set_locale (savelocale); } +void +rxvt_term::make_current () const +{ + SET_R (this); + rxvt_set_locale (locale); + set_environ (envv); +} + #if ENABLE_COMBINING class rxvt_composite_vec rxvt_composite; @@ -379,7 +387,7 @@ rxvt_term::destroy () void rxvt_term::destroy_cb (time_watcher &w) { - SET_R (this); + make_current (); delete this; } @@ -480,9 +488,8 @@ bool rxvt_term::init (int argc, const char *const *argv) { SET_R (this); - set_environ (envv); // few things in X do not call setlocale :( - set_locale (""); + set_environ (envv); // few things in X do not call setlocale :( if (!init_vars ()) return false; @@ -1629,7 +1636,7 @@ rxvt_term::im_cb () char **s; char buf[IMBUFSIZ]; - SET_R (this); + make_current (); im_destroy (); diff --git a/src/rxvt.h b/src/rxvt.h index 3d1e9bab..bf7b4994 100644 --- a/src/rxvt.h +++ b/src/rxvt.h @@ -1217,7 +1217,7 @@ struct rxvt_term : zero_initialized, rxvt_vars { long vt_emask, vt_emask_perl; - void vt_select_input () + void vt_select_input () const { XSelectInput (display->display, vt, vt_emask | vt_emask_perl); } @@ -1286,6 +1286,8 @@ struct rxvt_term : zero_initialized, rxvt_vars { bool pty_fill (); + void make_current () const; // make this the "currently active" urxvt instance + void init_secondary (); const char **init_resources (int argc, const char *const *argv); const char *x_resource (const char *name); @@ -1419,7 +1421,7 @@ struct rxvt_term : zero_initialized, rxvt_vars { // screen.C - void lalloc (line_t &l) + void lalloc (line_t &l) const { l.t = (text_t *)talloc->alloc (); l.r = (rend_t *)ralloc->alloc (); @@ -1433,7 +1435,7 @@ struct rxvt_term : zero_initialized, rxvt_vars { } #endif - void lresize (line_t &l) + void lresize (line_t &l) const { if (!l.t) return; @@ -1447,7 +1449,7 @@ struct rxvt_term : zero_initialized, rxvt_vars { scr_blank_line (l, prev_ncol, ncol - prev_ncol, DEFAULT_RSTYLE); } - int fgcolor_of (rend_t r) + int fgcolor_of (rend_t r) const { int base = GET_BASEFG (r); #ifndef NO_BRIGHTCOLOR @@ -1461,7 +1463,7 @@ struct rxvt_term : zero_initialized, rxvt_vars { return base; } - int bgcolor_of (rend_t r) + int bgcolor_of (rend_t r) const { int base = GET_BASEBG (r); #ifndef NO_BRIGHTCOLOR @@ -1475,7 +1477,7 @@ struct rxvt_term : zero_initialized, rxvt_vars { return base; } - bool option (uint32_t opt) + bool option (uint32_t opt) const { return OPTION (opt); } @@ -1488,8 +1490,8 @@ struct rxvt_term : zero_initialized, rxvt_vars { options &= ~opt; } - void scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs); - void scr_blank_screen_mem (line_t &l, rend_t efs); + void scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs) const; + void scr_blank_screen_mem (line_t &l, rend_t efs) const; int scr_scroll_text (int row1, int row2, int count); void scr_reset (); void scr_release (); diff --git a/src/rxvtlib.h.in b/src/rxvtlib.h.in index 47039c69..98145bfa 100644 --- a/src/rxvtlib.h.in +++ b/src/rxvtlib.h.in @@ -62,7 +62,7 @@ typedef struct rxvt_term *rxvt_t; extern rxvt_t rxvt_current_term; -#define SET_R(r) rxvt_current_term = (r) +#define SET_R(r) rxvt_current_term = const_cast(r) #define GET_R rxvt_current_term #define scrollbar_visible() scrollBar.state diff --git a/src/screen.C b/src/screen.C index 14270317..d0423454 100644 --- a/src/screen.C +++ b/src/screen.C @@ -117,7 +117,7 @@ inline void fill_text (text_t *start, text_t value, int len) /* Fill part/all of a line with blanks. */ void -rxvt_term::scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs) +rxvt_term::scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs) const { if (!l.t) { @@ -144,7 +144,7 @@ rxvt_term::scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend /* ------------------------------------------------------------------------- */ /* Fill a full line with blanks - make sure it is allocated first */ void -rxvt_term::scr_blank_screen_mem (line_t &l, rend_t efs) +rxvt_term::scr_blank_screen_mem (line_t &l, rend_t efs) const { scr_blank_line (l, 0, ncol, efs); -- 2.34.1