From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Rodrigo Morales Newsgroups: gmane.emacs.bugs Subject: bug#60094: current-column returns an incorrect number of columns for some characters Date: Thu, 15 Dec 2022 11:40:55 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000004ea38905efe08584" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1781"; mail-complaints-to="usenet@ciao.gmane.io" To: 60094@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 15 17:42:29 2022 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 1p5rJV-0000BY-0y for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 15 Dec 2022 17:42:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p5rJ6-00060A-JA; Thu, 15 Dec 2022 11:42:04 -0500 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 1p5rJ4-0005zE-Jx for bug-gnu-emacs@gnu.org; Thu, 15 Dec 2022 11:42:02 -0500 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 1p5rJ4-0003cV-99 for bug-gnu-emacs@gnu.org; Thu, 15 Dec 2022 11:42:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p5rJ3-0008SH-TM for bug-gnu-emacs@gnu.org; Thu, 15 Dec 2022 11:42:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Rodrigo Morales Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 15 Dec 2022 16:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 60094 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.167112248032490 (code B ref -1); Thu, 15 Dec 2022 16:42:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 15 Dec 2022 16:41:20 +0000 Original-Received: from localhost ([127.0.0.1]:43659 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p5rIN-0008Ry-Su for submit@debbugs.gnu.org; Thu, 15 Dec 2022 11:41:20 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:57474) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p5rIM-0008Rs-RV for submit@debbugs.gnu.org; Thu, 15 Dec 2022 11:41:19 -0500 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 1p5rIL-0005vR-Vy for bug-gnu-emacs@gnu.org; Thu, 15 Dec 2022 11:41:18 -0500 Original-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 ) id 1p5rII-0003XJ-5w for bug-gnu-emacs@gnu.org; Thu, 15 Dec 2022 11:41:16 -0500 Original-Received: by mail-vs1-xe2a.google.com with SMTP id m2so3420501vsv.9 for ; 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) Received-SPF: pass client-ip=2607:f8b0:4864:20::e2a; envelope-from=moralesrodrigo1100@gmail.com; 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-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:251117 Archived-At: --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
TL; DR: `current-column' returns `2' when the curs= or is in the first
column and the line contains a single emoji or a Chin= ese character. The
expected value is `1' as happens when the line co= ntains `a' or even the
highest defined codepoint in Unicode: `U+10FF= FD'.

In the minimal working example below, you can see that `cur= rent-columns'
returns `1' when the line contains the character `= a' and the cursor is
located after it.

,----
| cat ~/e/mai= n.el
`----

,----
| (with-temp-buffer
| =C2=A0 (insert "= ;a")
| =C2=A0 (end-of-line)
| =C2=A0 (princ (current-column)))`----

,----
| emacs -Q --batch -l ~/e/main.el
`----

,= ----
| 1
`----

In the minimal working example below, you can s= ee that `current-columns'
returns `1' when the line contains the= character `=F4=8F=BF=BD' (highest defined
codepoint in Unicode, U+1= 0FFFD) and the cursor is located after it.

,----
| cat ~/e/main.e= l
`----

,----
| (with-temp-buffer
| =C2=A0 (insert "= =F4=8F=BF=BD")
| =C2=A0 (end-of-line)
| =C2=A0 (princ (current-c= olumn)))
`----

,----
| 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 co= ntains an emoji and the cursor is located
after it.

,----
| ca= t ~/e/main.el
`----

,----
| (with-temp-buffer
| =C2=A0 (ins= ert "=F0=9F=91=8B")
| =C2=A0 (end-of-line)
| =C2=A0 (princ = (current-column)))
`----

,----
| emacs -Q --batch -l ~/e/main.= el
`----

,----
| 2
`----

In the minimal working exam= ple below, you can see that `current-columns'
returns `2' when t= he line contains a Chinese character and the cursor is
located after it.=

,----
| cat ~/e/main.el
`----

,----
| (with-temp-bu= ffer
| =C2=A0 (insert "=E4=BD=A0")
| =C2=A0 (end-of-line)| =C2=A0 (princ (current-column)))
`----

,----
| emacs -Q --= batch -l ~/e/main.el
`----

,----
| 2
`----
--0000000000004ea38905efe08584--