repo: rxvt-unicode-sixel
action: commit
revision: 
path_from: 
revision_from: 5e731b71e38879f9497440bd47fc5e5e6011e9b7:
path_to: 
revision_to: 
git.thebackupbox.net
rxvt-unicode-sixel
git clone git://git.thebackupbox.net/rxvt-unicode-sixel
commit 5e731b71e38879f9497440bd47fc5e5e6011e9b7
Author: Marc Lehmann 
Date:   Mon Aug 21 15:11:46 2006 +0000

    *** empty log message ***

diff --git a/Changes b/Changes
index b2be96af4e69aca9e347790455f2793900f8a674..
index ..9c8f185941a47ee5494b8020bf3c2dc81a02c7d5 100644
--- a/Changes
+++ b/Changes
@@ -21,12 +21,13 @@ WISH: http://www120.pair.com/mccarthy/nextstep/intro.htmld/Workspace.html is the
 WISH: kick out xpm.C, replace by pixbuf
 DUMB: support tex fonts

-TODO: rxvtd failing to enter cwd of rxvtc leads to crash due to free(this), Gentoo #143985
-TODO: fix crash because strwidth returning -1 in selection-popup in LC_ALL=C
+        - fixed urxvt::strwidth to calculate width in the same way as screen.C.
+	- fix a crash caused by passing negative widths to overlay functions.
 	- give proper diagnostic when RXVT_SOCKET is too long instead of
           corrupting the stack (patch by exg).
         - urxvtd no longer crashes when the client sends an inaccessible
-          working directory (reported by Roland Baer).
+          working directory (reported by Roland Baer, possibly fixes gentoo
+          bug #143985).
         - fixed many minor issues reported by Roland Baer.

 7.9  Mon Aug  7 18:16:07 CEST 2006
diff --git a/src/rxvtperl.xs b/src/rxvtperl.xs
index 9db946a64cd5fcd881c527956cb775362d848bba..
index ..de5d62fae69e682df24e47d41f2f443e7c62d1e8 100644
--- a/src/rxvtperl.xs
+++ b/src/rxvtperl.xs
@@ -1124,8 +1124,14 @@ rxvt_term::strwidth (SV *str)
         wchar_t *wstr = sv2wcs (str);

 	rxvt_push_locale (THIS->locale);
-        //TODO: use same algorithm as screen.C
-        RETVAL = wcswidth (wstr, wcslen (wstr));
+        RETVAL = 0;
+        for (wchar_t *wc = wstr; *wc; wc++)
+          {
+            int w = WCWIDTH (*wc);
+
+            if (w)
+              RETVAL += min (w, 1);
+          }
         rxvt_pop_locale ();

         free (wstr);

-----END OF PAGE-----