*** empty log message ***
authorroot <root>
Mon, 16 Jan 2006 06:37:51 +0000 (06:37 +0000)
committerroot <root>
Mon, 16 Jan 2006 06:37:51 +0000 (06:37 +0000)
Changes
doc/rxvtperl.3.html
doc/rxvtperl.3.man.in
doc/rxvtperl.3.txt
src/command.C
src/main.C
src/rxvt.h
src/rxvtlib.h.in
src/screen.C

diff --git a/Changes b/Changes
index b92a40eabc304f041a1142c617bf4f47fc585209..d59c1f07595aefb640e535820a5e1f5415d3c1da 100644 (file)
--- 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
index 841984cb2e966deb55d802284e6ddc844388559e..658bbd482d16ec466ad34038623c582e8ee42145 100644 (file)
@@ -1,7 +1,7 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-<title>urxvtperl - rxvt-unicode's embedded perl interpreter</title>
+<title>rxvtperl - rxvt-unicode's embedded perl interpreter</title>
 <link rev="made" href="mailto:perl-binary@plan9.de" />
 </head>
 
@@ -47,7 +47,7 @@
 </p>
 <hr />
 <h1><a name="name">NAME</a></h1>
-<p>urxvtperl - rxvt-unicode's embedded perl interpreter</p>
+<p>rxvtperl - rxvt-unicode's embedded perl interpreter</p>
 <p>
 </p>
 <hr />
@@ -60,9 +60,9 @@
       ()
    }</pre>
 <pre>
-   # start a urxvt using it:</pre>
+   # start a rxvt using it:</pre>
 <pre>
-   urxvt --perl-lib $HOME -pe grab_test</pre>
+   rxvt --perl-lib $HOME -pe grab_test</pre>
 <p>
 </p>
 <hr />
 the <code>perl</code> resource are loaded and associated with it.</p>
 <p>Scripts are compiled in a 'use strict' and 'use utf8' environment, and
 thus must be encoded as UTF-8.</p>
-<p>Each script will only ever be loaded once, even in urxvtd, where
+<p>Each script will only ever be loaded once, even in rxvtd, where
 scripts will be shared (but not enabled) for all terminals.</p>
 <p>
 </p>
 <hr />
 <h1><a name="prepackaged_extensions">PREPACKAGED EXTENSIONS</a></h1>
 <p>This section describes the extensions delivered with this release. You can
-find them in <em>/usr/local/lib/urxvt/perl/</em>.</p>
+find them in <em>/opt/rxvt/lib/urxvt/perl/</em>.</p>
 <p>You can activate them like this:</p>
 <pre>
-  urxvt -pe &lt;extensionname&gt;</pre>
+  rxvt -pe &lt;extensionname&gt;</pre>
 <dl>
 <dt><strong><a name="item_selection">selection (enabled by default)</a></strong><br />
 </dt>
@@ -491,7 +491,7 @@ Called just after the screen gets redrawn. See <code>on_refresh_begin</code>.
 <dd>
 Called whenever the user presses a key combination that has a
 <code>perl:string</code> action bound to it (see description of the <strong>keysym</strong>
-resource in the <code>urxvt(1)</code> manpage).
+resource in the <code>rxvt(1)</code> manpage).
 </dd>
 <p></p>
 <dt><strong><a name="item_on_x_event__24term_2c__24event">on_x_event $term, $event</a></strong><br />
@@ -737,7 +737,7 @@ initialise perl, and the terminal object otherwise. The <code>init</code> and
 </dt>
 <dd>
 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.
 </dd>
 <p></p>
@@ -822,7 +822,7 @@ the wrong resources.</p>
 </dt>
 <dd>
 Adds a keymap translation exactly as specified via a resource. See the
-<code>keysym</code> resource in the <code>urxvt(1)</code> manpage.
+<code>keysym</code> resource in the <code>rxvt(1)</code> manpage.
 </dd>
 <p></p>
 <dt><strong><a name="item_rstyle">$rend = $term-&gt;rstyle ([$new_rstyle])</a></strong><br />
@@ -1056,7 +1056,7 @@ to receive pointer events all the times:
 </dt>
 <dt><strong><a name="item_total_rows">$nrow_plus_saveLines = $term-&gt;total_rows</a></strong><br />
 </dt>
-<dt><strong><a name="item_nsaved">$lines_in_scrollback = $term-&gt;nsaved</a></strong><br />
+<dt><strong><a name="item_top_row">$topmost_scrollback_row = $term-&gt;top_row</a></strong><br />
 </dt>
 <dd>
 Return various integers describing terminal characteristics.
@@ -1095,8 +1095,8 @@ AltGr), the meta key (often Alt) and the num lock key, if applicable.
 <dt><strong><a name="item_view_start">$view_start = $term-&gt;view_start ([$newvalue])</a></strong><br />
 </dt>
 <dd>
-Returns the negative row number of the topmost line. Minimum value is
-<code>0</code>, which displays the normal terminal contents. Larger values scroll
+Returns the row number of the topmost displayed line. Maximum value is
+<code>0</code>, which displays the normal terminal contents. Lower values scroll
 this many lines into the scrollback buffer.
 </dd>
 <p></p>
@@ -1117,7 +1117,7 @@ differ, it redraws the differences.
 Returns the text of the entire row with number <code>$row_number</code>. Row <code>0</code>
 is the topmost terminal line, row <code>$term-&gt;$ncol-1</code> is the bottommost
 terminal line. The scrollback buffer starts at line <code>-1</code> and extends to
-line <a href="#item_nsaved"><code>-$term-&gt;nsaved</code></a>. Nothing will be returned if a nonexistent line
+line <code>-$term-&gt;nsaved</code>. Nothing will be returned if a nonexistent line
 is requested.
 </dd>
 <dd>
index 48ebd2587166cf6a7423554b758329523be9a542..d1a5f46106edd8643bbe9c6d5a69bb973a98c33d 100644 (file)
 .\" ========================================================================
 .\"
 .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"
index 137eea04af3c909fe0ca09140ace2b76cef8f574..d36bf8c9409cfd64ec1163563f1ee2560f778268 100644 (file)
@@ -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 <extensionname>
+      rxvt -pe <extensionname>
 
     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
index f2d77bd858e7a82348e68428879858f282cb056f..75882ce088b3619e77c714c9c76424327456ef05 100644 (file)
@@ -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)
     {
index e91fb83909e160f1a41123e302ada0c24d9b7b2d..ae3210b35427b1dc7302976de87f92033258bc48 100644 (file)
@@ -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 ();
 
index 3d1e9babf810a47549762ff5ec73365eda3a9cd4..bf7b4994ac58a1d5cd45f83f7f4df9748c5fff17 100644 (file)
@@ -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 ();
index 47039c69c56ba945712008988178de256936dbcc..98145bfac4a90d986b98628efa3a406a5a73c843 100644 (file)
@@ -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<rxvt_term *>(r)
 #define GET_R rxvt_current_term
 
 #define scrollbar_visible()    scrollBar.state
index 142703172c5cae4d63c39d8200a67449fbaa9255..d0423454a6748f1978e435ddbb7530332683c88b 100644 (file)
@@ -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);