*** empty log message ***
authorroot <root>
Fri, 6 Jan 2006 18:33:30 +0000 (18:33 +0000)
committerroot <root>
Fri, 6 Jan 2006 18:33:30 +0000 (18:33 +0000)
src/command.C
src/rxvt.h
src/rxvtperl.h
src/rxvtperl.xs
src/screen.C

index 55e086d..a581917 100644 (file)
@@ -2892,7 +2892,7 @@ uint32_t
 rxvt_term::next_octet ()
 {
   return cmdbuf_ptr < cmdbuf_endp
-         ? *cmdbuf_ptr++
+         ? (unsigned char)*cmdbuf_ptr++
          : NOCHAR;
 }
 
index 92811b8..ca199e5 100644 (file)
@@ -1296,10 +1296,10 @@ struct rxvt_term : zero_initialized, rxvt_vars {
   void lookup_key (XKeyEvent &ev);
   unsigned int cmd_write (const char *str, unsigned int count);
 
-  unicode_t next_char ();
-  unicode_t cmd_getc ();
-  unicode_t next_octet ();
-  unicode_t cmd_get8 ();
+  wchar_t next_char ();
+  wchar_t cmd_getc ();
+  uint32_t next_octet ();
+  uint32_t cmd_get8 ();
 
   bool cmd_parse ();
   void mouse_report (XButtonEvent &ev);
@@ -1463,7 +1463,7 @@ struct rxvt_term : zero_initialized, rxvt_vars {
   int scr_change_screen (int scrn);
   void scr_color (unsigned int color, int fgbg);
   void scr_rendition (int set, int style);
-  void scr_add_lines (const unicode_t *str, int nlines, int len);
+  void scr_add_lines (const wchar_t *str, int len, int minlines = 0);
   void scr_backspace ();
   void scr_tab (int count, bool ht = false);
   void scr_gotorc (int row, int col, int relative);
index e76de58..ba52c12 100644 (file)
@@ -15,9 +15,9 @@ enum data_type {
   DT_END,
   DT_INT,
   DT_LONG,
-  DT_STRING,
-  DT_STRING_LEN,
-  DT_USTRING_LEN,
+  DT_STR,
+  DT_STR_LEN,
+  DT_WCS_LEN,
   DT_XEVENT,
 };
 
index afd55ff..efd63c5 100644 (file)
@@ -467,11 +467,11 @@ rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...)
           XPUSHs (sv_2mortal (newSViv (va_arg (ap, long))));
           break;
 
-        case DT_STRING:
+        case DT_STR:
           XPUSHs (sv_2mortal (newSVpv (va_arg (ap, char *), 0)));
           break;
 
-        case DT_STRING_LEN:
+        case DT_STR_LEN:
           {
             char *str = va_arg (ap, char *);
             int len = va_arg (ap, int);
@@ -480,6 +480,14 @@ rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...)
           }
           break;
 
+        case DT_WCS_LEN:
+          {
+            wchar_t *wstr = va_arg (ap, wchar_t *);
+            int wlen = va_arg (ap, int);
+
+            XPUSHs (sv_2mortal (wcs2sv (wstr, wlen)));
+          }
+
         case DT_XEVENT:
           {
             XEvent *xe = va_arg (ap, XEvent *);
@@ -532,20 +540,6 @@ rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...)
           }
           break;
 
-        case DT_USTRING_LEN:
-          {
-            unicode_t *ustr = va_arg (ap, unicode_t *);
-            int ulen = va_arg (ap, int);
-            wchar_t *wstr = new wchar_t [ulen];
-
-            for (int i = ulen; i--; )
-              wstr [i] = ustr [i];
-
-            XPUSHs (sv_2mortal (wcs2sv (wstr, ulen)));
-
-            delete [] wstr;
-          }
-
         case DT_END:
           {
             va_end (ap);
@@ -1063,20 +1057,8 @@ rxvt_term::scr_add_lines (SV *string)
        CODE:
 {
         wchar_t *wstr = sv2wcs (string);
-        int wlen = wcslen (wstr);
-        unicode_t *ustr = new unicode_t [wlen];
-        int nlines = 0;
-
-        for (int i = wlen; i--; )
-          {
-            ustr [i] = wstr [i];
-            nlines += ustr [i] == '\012';
-          }
-
-        THIS->scr_add_lines (ustr, nlines, wlen);
-
+        THIS->scr_add_lines (wstr, wcslen (wstr));
         free (wstr);
-        delete [] ustr;
 }
 
 void
index 60caa77..98db4ac 100644 (file)
@@ -702,7 +702,7 @@ rxvt_term::scr_scroll_text (int row1, int row2, int count)
  * Add text given in <str> of length <len> to screen struct
  */
 void
-rxvt_term::scr_add_lines (const unicode_t *str, int nlines, int len)
+rxvt_term::scr_add_lines (const wchar_t *str, int len, int minlines)
 {
   if (len <= 0)               /* sanity */
     return;
@@ -710,22 +710,22 @@ rxvt_term::scr_add_lines (const unicode_t *str, int nlines, int len)
   unsigned char checksel;
   unicode_t c;
   int ncol = this->ncol;
-  const unicode_t *strend = str + len;
+  const wchar_t *strend = str + len;
 
   want_refresh = 1;
   ZERO_SCROLLBACK ();
 
-  if (nlines > 0)
+  if (minlines > 0)
     {
-      nlines += screen.cur.row - screen.bscroll;
+      minlines += screen.cur.row - screen.bscroll;
 
-      if (nlines > 0
+      if (minlines > 0
           && screen.tscroll == 0
           && screen.bscroll == nrow - 1)
         {
           /* _at least_ this many lines need to be scrolled */
-          scr_scroll_text (screen.tscroll, screen.bscroll, nlines);
-          screen.cur.row -= nlines;
+          scr_scroll_text (screen.tscroll, screen.bscroll, minlines);
+          screen.cur.row -= minlines;
         }
     }
 
@@ -742,7 +742,7 @@ rxvt_term::scr_add_lines (const unicode_t *str, int nlines, int len)
 
   while (str < strend)
     {
-      c = *str++;
+      c = (unicode_t)*str++; // convert to rxvt-unicodes representation
 
       if (c < 0x20)
         if (c == C0_LF)