[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: href "title" attribute
- From: Kevin Ryde <user42@xxxxxxxxxx>
- Date: Sun, 23 Jan 2011 10:52:37 +1100
- X-ml-name: emacs-w3m
- X-mail-count: 11494
- References: <87d3oesu2d.fsf@xxxxxxxxx> <20110103.163353.214432641.1BF46D@xxxxxxxxxxx> <20110104.223841.133868059.1BF46D@xxxxxxxxxxx> <871v4kfi6z.fsf@xxxxxxxxx> <b4mfwt0137n.fsf@xxxxxxx>
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))))))