Eli Zaretskii <eliz@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 60094) by debbugs.gnu.org; 15 Dec 2022 16:56:56 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 15 11:56:56 2022 Received: from localhost ([127.0.0.1]:43744 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1p5rXU-0000E9-82 for submit <at> debbugs.gnu.org; Thu, 15 Dec 2022 11:56:56 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46986) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1p5rXO-0000Dv-IX; Thu, 15 Dec 2022 11:56:54 -0500 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 <eliz@HIDDEN>) id 1p5rXJ-0002Ca-6D; Thu, 15 Dec 2022 11:56:45 -0500 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=zOxZbmskNIOxyypgCOB35sqgnlS69AyxdSwwqeS/fe8=; b=c2C91o2yAcPpKEKs2CFk NyONfs7szvQthMUxEy82xDlB1M2ebmX9yxLqGFVXduMMoQBTfy/VRnG7C9UWtLYrPYa2S88UqtcpV GHfnSwWRf8BhTQya5z3hbUzGPCzNcQ6xNDO7nVyRrQUkGCJQk388QoxN5H3kCbBsYlyD1lbnpbH4b WIhq2NglvCjV3+HtOwCivmCkl3Q0PhzbhC+tM7e6v06gbIvwxjfsGzpwjFfH1J/jEuNFrV7Z96pak YkxohUrFdf7NbtTPe50F8W/R4JXbFjBJxmj4aeVKxzbWSiK6SwW+jot19V/Ioo9uZ/5MTqd2/nl8n Q1W9aTZJiGwGNg==; 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 <eliz@HIDDEN>) id 1p5rXI-0001E1-4O; Thu, 15 Dec 2022 11:56:44 -0500 Date: Thu, 15 Dec 2022 18:56:43 +0200 Message-Id: <83wn6sk3lg.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Rodrigo Morales <moralesrodrigo1100@HIDDEN> In-Reply-To: <CAGxMbPayCcy+_LDGRJvWiCpw83u8nyE+TQ3b0QHnKfehVOkkLw@HIDDEN> (message from Rodrigo Morales on Thu, 15 Dec 2022 11:40:55 -0500) Subject: Re: bug#60094: current-column returns an incorrect number of columns for some characters References: <CAGxMbPayCcy+_LDGRJvWiCpw83u8nyE+TQ3b0QHnKfehVOkkLw@HIDDEN> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60094 Cc: 60094 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) tags 60094 notabug thanks > From: Rodrigo Morales <moralesrodrigo1100@HIDDEN> > Date: Thu, 15 Dec 2022 11:40:55 -0500 > > In the minimal working example below, you can see that `current-columns' > returns `2' when the line contains an emoji and the cursor is located > after it. > > ,---- > | cat ~/e/main.el > `---- > > ,---- > | (with-temp-buffer > | (insert "👋") > | (end-of-line) > | (princ (current-column))) > `---- > > ,---- > | emacs -Q --batch -l ~/e/main.el > `---- > > ,---- > | 2 > `---- > > In the minimal working example below, you can see that `current-columns' > returns `2' when the line contains a Chinese character and the cursor is > located after it. > > ,---- > | cat ~/e/main.el > `---- > > ,---- > | (with-temp-buffer > | (insert "ä½ ") > | (end-of-line) > | (princ (current-column))) > `---- > > ,---- > | emacs -Q --batch -l ~/e/main.el > `---- > > ,---- > | 2 > `---- These are the expected and correct results: these characters have width that is very close to 2 canonical columns. And current-column counts canonical columns, not just characters. If you type regular characters, like 'a', above or below this Emoji or the Chinese character, you will see that for each such Emoji you can type 2 regular characters. So there's no bug here: Emacs does what it's supposed to do. The doc string of current-column says: This is calculated by adding together the widths of all the displayed representations of the character between the start of the previous line and point (e.g., control characters will have a width of 2 or 4, tabs will have a variable width). Note the "displayed representations" part.
bug-gnu-emacs@HIDDEN
:bug#60094
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 15 Dec 2022 16:41:20 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 15 11:41:20 2022 Received: from localhost ([127.0.0.1]:43659 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1p5rIN-0008Ry-Su for submit <at> debbugs.gnu.org; Thu, 15 Dec 2022 11:41:20 -0500 Received: from lists.gnu.org ([209.51.188.17]:57474) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <moralesrodrigo1100@HIDDEN>) id 1p5rIM-0008Rs-RV for submit <at> debbugs.gnu.org; Thu, 15 Dec 2022 11:41:19 -0500 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 <moralesrodrigo1100@HIDDEN>) id 1p5rIL-0005vR-Vy for bug-gnu-emacs@HIDDEN; Thu, 15 Dec 2022 11:41:18 -0500 Received: from mail-vs1-xe2a.google.com ([2607:f8b0:4864:20::e2a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <moralesrodrigo1100@HIDDEN>) id 1p5rII-0003XJ-5w for bug-gnu-emacs@HIDDEN; Thu, 15 Dec 2022 11:41:16 -0500 Received: by mail-vs1-xe2a.google.com with SMTP id m2so3420501vsv.9 for <bug-gnu-emacs@HIDDEN>; Thu, 15 Dec 2022 08:41:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=GcxFl9U95otX01426m5EtrIG57iK/hrq46HjLWALeFI=; b=OIuZny9b10PtB43DX/XwI5vJadnWIQkYDUAjeXvH763HrlPVSyhWPQ2w6cEOneh9i1 qOxuY2oq8d8ZTsWztqkwIr9Wg/G1PU4FiR9+A5+vGVMQuRBq6hqkMggqgAzFi/0fDmry Eyw1Jg91ILfYrxKPIr9prCThY1WrFYfJHatRdZo4DTQxoeqjfUmzAriVXGWrMTfeYi0O TlmrLRlySu4x/5poIPZbdYTNkCZaYqiLsStQ/n1mDvgQ04wogPFqv262Z1Pc3iEuN1Y5 Up2FmlzlX8yy3mXr+JHEK/44xKvwQktMGPQ3Xr8q8dj+tA/AL551d3bBOPKWBxOkHLF5 1nhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=GcxFl9U95otX01426m5EtrIG57iK/hrq46HjLWALeFI=; b=EnQVZIKPs6xnG5fsBGNwQYDSNhcP1x4L3FUQKb5XZad8Jp8GvklQuEXOSW5mEzXR32 48jgbSaXPTjJiDeF8KRY4LiEw8cCQagichstnckynIKKGJD00reDnI31pweuTqBSvOZz iRhrXpALKl/Uf3SxyoDlwH8IRgY42xR6ZlEOL/8CduOXgloWMwR3g0NKZjKY0yTdU+jb pxecit0sOCQtG7hBrfNu+J3esqeZO8euS38YDN2qEeSIQkAN1xD4NxHSP3kHnZaTgYg8 3puC+Nc5N5DXBS6Mg61wQGBqHEraHkyo++2ZNSnBcQBty/6cshDtR3qsHRI3rkXXyxn7 rlGQ== X-Gm-Message-State: ANoB5pl7qBuQW51U9DkCtspdULeboKFv9Gt2jNRPQQ8Cf+LBAvUJ2uBZ F8DzGT/AXmCrI7Nwo8U17sUIEy635quliUsxKSl9tPEmZvU= X-Google-Smtp-Source: AA0mqf71HYqppVmVSXc19hX/CTiIBe5839uFQz+UfgN2sNTcnlMwphGCtrDnMc6D4ihTkCbdsXCUI5OgBO+WzAdW4Ps= X-Received: by 2002:a05:6102:5ee:b0:3b1:a1c:3cab with SMTP id w14-20020a05610205ee00b003b10a1c3cabmr19159634vsf.46.1671122471787; Thu, 15 Dec 2022 08:41:11 -0800 (PST) MIME-Version: 1.0 From: Rodrigo Morales <moralesrodrigo1100@HIDDEN> Date: Thu, 15 Dec 2022 11:40:55 -0500 Message-ID: <CAGxMbPayCcy+_LDGRJvWiCpw83u8nyE+TQ3b0QHnKfehVOkkLw@HIDDEN> Subject: current-column returns an incorrect number of columns for some characters To: bug-gnu-emacs@HIDDEN Content-Type: multipart/alternative; boundary="0000000000004ea38905efe08584" Received-SPF: pass client-ip=2607:f8b0:4864:20::e2a; envelope-from=moralesrodrigo1100@HIDDEN; helo=mail-vs1-xe2a.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.1 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.1 (--) --0000000000004ea38905efe08584 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable TL; DR: `current-column' returns `2' when the cursor is in the first column and the line contains a single emoji or a Chinese character. The expected value is `1' as happens when the line contains `a' or even the highest defined codepoint in Unicode: `U+10FFFD'. In the minimal working example below, you can see that `current-columns' returns `1' when the line contains the character `a' and the cursor is located after it. ,---- | cat ~/e/main.el `---- ,---- | (with-temp-buffer | (insert "a") | (end-of-line) | (princ (current-column))) `---- ,---- | emacs -Q --batch -l ~/e/main.el `---- ,---- | 1 `---- In the minimal working example below, you can see that `current-columns' returns `1' when the line contains the character `=F4=8F=BF=BD' (highest de= fined codepoint in Unicode, U+10FFFD) and the cursor is located after it. ,---- | cat ~/e/main.el `---- ,---- | (with-temp-buffer | (insert "=F4=8F=BF=BD") | (end-of-line) | (princ (current-column))) `---- ,---- | emacs -Q --batch -l ~/e/main.el `---- ,---- | 1 `---- In the minimal working example below, you can see that `current-columns' returns `2' when the line contains an emoji and the cursor is located after it. ,---- | cat ~/e/main.el `---- ,---- | (with-temp-buffer | (insert "=F0=9F=91=8B") | (end-of-line) | (princ (current-column))) `---- ,---- | emacs -Q --batch -l ~/e/main.el `---- ,---- | 2 `---- In the minimal working example below, you can see that `current-columns' returns `2' when the line contains a Chinese character and the cursor is located after it. ,---- | cat ~/e/main.el `---- ,---- | (with-temp-buffer | (insert "=E4=BD=A0") | (end-of-line) | (princ (current-column))) `---- ,---- | emacs -Q --batch -l ~/e/main.el `---- ,---- | 2 `---- --0000000000004ea38905efe08584 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">TL; DR: `current-column' returns `2' when the curs= or is in the first<br>column and the line contains a single emoji or a Chin= ese character. The<br>expected value is `1' as happens when the line co= ntains `a' or even the<br>highest defined codepoint in Unicode: `U+10FF= FD'.<br><br>In the minimal working example below, you can see that `cur= rent-columns'<br>returns `1' when the line contains the character `= a' and the cursor is<br>located after it.<br><br>,----<br>| cat ~/e/mai= n.el<br>`----<br><br>,----<br>| (with-temp-buffer<br>| =C2=A0 (insert "= ;a")<br>| =C2=A0 (end-of-line)<br>| =C2=A0 (princ (current-column)))<b= r>`----<br><br>,----<br>| emacs -Q --batch -l ~/e/main.el<br>`----<br><br>,= ----<br>| 1<br>`----<br><br>In the minimal working example below, you can s= ee that `current-columns'<br>returns `1' when the line contains the= character `=F4=8F=BF=BD' (highest defined<br>codepoint in Unicode, U+1= 0FFFD) and the cursor is located after it.<br><br>,----<br>| cat ~/e/main.e= l<br>`----<br><br>,----<br>| (with-temp-buffer<br>| =C2=A0 (insert "= =F4=8F=BF=BD")<br>| =C2=A0 (end-of-line)<br>| =C2=A0 (princ (current-c= olumn)))<br>`----<br><br>,----<br>| emacs -Q --batch -l ~/e/main.el<br>`---= -<br><br>,----<br>| 1<br>`----<br><br>In the minimal working example below,= you can see that `current-columns'<br>returns `2' when the line co= ntains an emoji and the cursor is located<br>after it.<br><br>,----<br>| ca= t ~/e/main.el<br>`----<br><br>,----<br>| (with-temp-buffer<br>| =C2=A0 (ins= ert "=F0=9F=91=8B")<br>| =C2=A0 (end-of-line)<br>| =C2=A0 (princ = (current-column)))<br>`----<br><br>,----<br>| emacs -Q --batch -l ~/e/main.= el<br>`----<br><br>,----<br>| 2<br>`----<br><br>In the minimal working exam= ple below, you can see that `current-columns'<br>returns `2' when t= he line contains a Chinese character and the cursor is<br>located after it.= <br><br>,----<br>| cat ~/e/main.el<br>`----<br><br>,----<br>| (with-temp-bu= ffer<br>| =C2=A0 (insert "=E4=BD=A0")<br>| =C2=A0 (end-of-line)<b= r>| =C2=A0 (princ (current-column)))<br>`----<br><br>,----<br>| emacs -Q --= batch -l ~/e/main.el<br>`----<br><br>,----<br>| 2<br>`----<br></div> --0000000000004ea38905efe08584--
Rodrigo Morales <moralesrodrigo1100@HIDDEN>
:bug-gnu-emacs@HIDDEN
.
Full text available.bug-gnu-emacs@HIDDEN
:bug#60094
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.