[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

Re: href "title" attribute



I see I should have used string-width ...

2011-01-23  Kevin Ryde  <user42@xxxxxxxxxx>

	* w3m.el (w3m-print-this-url): Correction to my last, use string-width
	not length.
--- w3m.el.~1.1515.~	2011-01-23 10:50:41.000000000 +1100
+++ w3m.el	2011-01-23 10:51:24.000000000 +1100
@@ -7155,15 +7155,17 @@
 			 ((> (length alt) 0)
 			  (concat alt ": " url))
 			 ((> (length title) 0)
-			  ;; XEmacs doesn't have `message-truncate-lines'
+			  ;; XEmacs21 doesn't have `message-truncate-lines'
 			  ;; and always truncates messages, so one line in
 			  ;; that case.
-			  (if (or (not (boundp 'message-truncate-lines))
-				  message-truncate-lines
-				  (< (+ (length url) (length title) 5)
-				     (frame-width)))
-			      (concat title " (" url ")") ;; one line if fits
-			    (concat title "\n" url)))     ;; two lines if big
+                          (let ((str (concat title " (" url ")")))
+                            (if (or (not (boundp 'message-truncate-lines))
+                                    message-truncate-lines
+                                    (< (string-width str) (- (frame-width) 2)))
+                                ;; one line if fits or truncating
+                                str
+                              ;; or two lines if bigger than frame-width
+                              (concat title "\n" url))))
 			 (t
 			  url))))))