[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
 Re: [emacs-w3m/emacs-w3m] Bb history display (#4)
- From: Boruch Baum <notifications@xxxxxxxxxx>
- Date: Sun, 24 Feb 2019 18:47:04 -0800
- X-ml-name: emacs-w3m
- X-mail-count: 13255
- References: <emacs-w3m/emacs-w3m/pull/4@github.com>
On 2019-02-24 17:50, yamaoka wrote:
>    [1]@Boruch-Baum
>
>      [line 10821] (width (- (w3m-display-width) 21)): [2]@yamaoka says
>      that this is because how 'wide' characters appear differently in
>      different environments. If so, is this really the correct solution?
>
>    w3m-db-history-fix-indentation' and tweaking the width' (-21) are no
>    more than a workarounds.
>
>      It doesn't properly handle the character in my utf-8 environment,
>      and what about any number of wide characters that could be present
>      in the URL title? Shouldn't there be some kind of environment check
>      and count of all the wide characters, instead of just adding '2' in
>      all cases, even if its not needed?
>
>    That is a w3m problem, not that of Emacs or emacs-w3m, I think (though
>    Emacs on TTY makes a mysterious behavior). Emacs (at least the ones I
>    have) says that the string width of "…" is 2 no matter what display (X
>    or TTY) or font is used. Please try the attached ELisp snippet and
>
>    Eval: (and (search-forward "bar" nil t) (goto-char (match-beginning
>    0)))
>
>    in the beginning of each "foo" line.
>    [3]ELisp2.gz
I did. What I get is:
foo…                                            bar
 `bar' starts at the column 48
foo**                                           bar
 `bar' starts at the column 48
But I don't understand why or how that's relevant. For (string-width
"…"), I get an answer of '1'...
I also tried the following, which also gives me values of one for everything:
(let ((ellipsis "…"))
  (dolist (enc
	 '((us_ascii      . raw-text)
	   (us-ascii      . raw-text)
	   (gb2312	  . cn-gb-2312)
	   (cn-gb	  . cn-gb-2312)
	   (iso-2022-jp-2 . iso-2022-7bit-ss2)
	   (iso-2022-jp-3 . iso-2022-7bit-ss2)
	   (tis-620	  . tis620)
	   (windows-874	  . tis-620)
	   (cp874	  . tis-620)
	   (x-ctext       . ctext)
	   (unknown       . undecided)
	   (x-unknown     . undecided)
	   (windows-1250  . cp1250)
	   (windows-1251  . cp1251)
	   (windows-1252  . cp1252)
	   (windows-1253  . cp1253)
	   (windows-1254  . cp1254)
	   (windows-1255  . cp1255)
	   (windows-1256  . cp1256)
	   (windows-1257  . cp1257)
	   (windows-1258  . cp1258)
	   (euc-jp	  . euc-japan)
	   (shift-jis     . shift_jis)
	   (shift_jis     . shift_jis)
	   (sjis	  . shift_jis)
	   (x-euc-jp      . euc-japan)
	   (x-shift-jis   . shift_jis)
	   (x-shift_jis   . shift_jis)
	   (x-sjis	  . shift_jis)))
  ; test #1
  (with-coding-priority (list (cdr enc))
    (message "%d: %s"
      (string-width ellipsis)
      (car enc)))
  ; test #2
  (message "%d: %s"
    (string-width (decode-coding-string ellipsis (cdr enc)))
    (car enc))))
-- 
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.![]()