unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Shigeru Fukaya <shigeru.fukaya@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 17822@debbugs.gnu.org
Subject: bug#17822: bs-show with mulitbyte characters doesn't work well
Date: Sat, 21 Jun 2014 12:35:55 +0900	[thread overview]
Message-ID: <3BCF8D01E8F422shigeru.fukaya@gmail.com> (raw)
In-Reply-To: <jwvsimzz92u.fsf-monnier+emacsbugs@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 438 bytes --]

>> `bs-show' displays buffer information on incorrect column position.
>> It is because `bs-show' calculates column using `length' for multibyte
>> strings.
>
>> Just changing `length' to `string-width' in `bs-show-in-buffer' and
>> `bs--insert-one-entry' will solve the problem.
>
>Indeed (tho this is not a "multibyte" problem, but a problem with
>double-width chars).
Oh, I'll remember the term.

>Can you provide a patch?
OK

Shigeru

[-- Attachment #2: bs.diff --]
[-- Type: application/octet-stream, Size: 777 bytes --]

--- orig/bs.el	2014-03-21 14:34:40.000000000 +0900
+++ ./bs.el	2014-06-21 12:26:39.114537800 +0900
@@ -1128,7 +1128,7 @@ and move point to current buffer."
   (bs-mode)
   (let* ((inhibit-read-only t)
 	 (map-fun (lambda (entry)
-		    (length (buffer-name entry))))
+		    (string-width (buffer-name entry))))
 	 (max-length-of-names (apply 'max
 				     (cons 0 (mapcar map-fun list))))
 	 (name-entry-length (min bs-maximal-buffer-name-column
@@ -1340,7 +1340,7 @@ normally *buffer-selection*."
 							  apply-args)
 					   (nth 3 column)                ; align
 					   (- min to-much)))
-	       (len (length new-string)))
+	       (len (string-width new-string)))
 	  (setq string (concat string new-string))
 	  (when (> len min)
 	    (setq to-much (- len min))))))

  reply	other threads:[~2014-06-21  3:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-20 17:25 bug#17822: bs-show with mulitbyte characters doesn't work well Shigeru Fukaya
2014-06-20 19:16 ` Stefan Monnier
2014-06-21  3:35   ` Shigeru Fukaya [this message]
2018-09-19 23:02     ` Noam Postavsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3BCF8D01E8F422shigeru.fukaya@gmail.com \
    --to=shigeru.fukaya@gmail.com \
    --cc=17822@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).