From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#64420: string-width of =?UTF-8?Q?=E2=80=A6?= is 2 in CJK environments Date: Sun, 02 Jul 2023 16:10:03 +0300 Message-ID: <83cz1ao3x0.fsf@gnu.org> References: <961e5083-ccf3-9d39-175d-5c5957130d50@gutov.dev> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4166"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 64420@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 02 15:10:26 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qFwqQ-0000sx-6y for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 02 Jul 2023 15:10:26 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qFwq7-0000JQ-0o; Sun, 02 Jul 2023 09:10:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qFwq3-0000Iz-FL for bug-gnu-emacs@gnu.org; Sun, 02 Jul 2023 09:10:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qFwq2-0003XR-7b for bug-gnu-emacs@gnu.org; Sun, 02 Jul 2023 09:10:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qFwq1-0002yC-Lc for bug-gnu-emacs@gnu.org; Sun, 02 Jul 2023 09:10:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 02 Jul 2023 13:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64420 X-GNU-PR-Package: emacs Original-Received: via spool by 64420-submit@debbugs.gnu.org id=B64420.168830338111383 (code B ref 64420); Sun, 02 Jul 2023 13:10:01 +0000 Original-Received: (at 64420) by debbugs.gnu.org; 2 Jul 2023 13:09:41 +0000 Original-Received: from localhost ([127.0.0.1]:59521 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qFwph-0002xW-6d for submit@debbugs.gnu.org; Sun, 02 Jul 2023 09:09:41 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:46062) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qFwpc-0002xG-9j for 64420@debbugs.gnu.org; Sun, 02 Jul 2023 09:09:39 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qFwpW-0003UB-Ex; Sun, 02 Jul 2023 09:09:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=fO94ipnoDpSv4GhJ+E4GwDixe/gHeAVaXAAp3UKJwgo=; b=JpbDQ45/BQpyEZt7jh9d 7ZpxisOYB3npQkrI2N/aGRa6R/tbzMgK9NJ3y/PuvnstWnuSXHW+oGQvNNp+00o/DJMp2BTWK9pm2 t58rCpgmrzsZhqHZcPOTfftz5ACBWARB/LzzWn7EYaURJ6qOOChWWb9oC1QwRqcyY5RskjyJRdd0G VwLuHqQ9GuFLC5nmg3ZoFHCFFxOOqZhs1m08iX2SieAlbePG+hnp9ivYKvtOYXVYtLjqBmchqojML 8PqeeM3gCfye20HLiM10b5UO89NhJnPLzoN+gsMrNoERhHiln8xHlARqK2xlZ4EUNwPu+vAFJKeey H8TtCvt3dZEx1w==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qFwpV-0001Nu-Ta; Sun, 02 Jul 2023 09:09:30 -0400 In-Reply-To: <961e5083-ccf3-9d39-175d-5c5957130d50@gutov.dev> (message from Dmitry Gutov on Sun, 2 Jul 2023 15:57:07 +0300) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:264484 Archived-At: > Date: Sun, 2 Jul 2023 15:57:07 +0300 > From: Dmitry Gutov > > Hi! This was reported to company-mode > (https://github.com/company-mode/company-mode/issues/1388), as a > scenario that makes the overlay-based completion popup misrender because > the columns are not computed right when that char is present. > > To repro: > > (set-language-environment "Chinese-BIG5") > (string-width "…") ;; => 2 > > In the default language environment its width is reported to be 1. > > This doesn't seem to make sense because it's rendered one column wide > either way. On GUI frames Lisp programs that need to know the actual width of some string should use string-pixel-width, not string-width. The latter is basically only for TTY frames. (progn (set-language-environment "Chinese-BIG5") (ceiling (/ (string-pixel-width "…") (float (default-font-width))))) ;; => 1