Subject: bug#60094: closed (Re: bug#60094: current-column returns an incorrect number of columns for some characters)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 04 Sep 2023 21:12:02 +0000

Your bug report

#60094: current-column returns an incorrect number of columns for some characters

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
60094: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=60094
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#60094: current-column returns an incorrect number of columns for some characters
From: Stefan Kangas <[email-masked]>
To: Eli Zaretskii <[email-masked]>
Cc: [email-masked], Rodrigo Morales <[email-masked]>
Date: Mon, 4 Sep 2023 14:11:42 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

Eli Zaretskii <[email-masked]> writes:

> tags 60094 notabug
> thanks
[...]
> 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.

Thanks, I'm therefore closing this bug report.

Subject: current-column returns an incorrect number of columns for some characters
From: Rodrigo Morales <[email-masked]>
To: [email-masked]
Date: Thu, 15 Dec 2022 11:40:55 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

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 `􏿽' (highest defined
codepoint in Unicode, U+10FFFD) 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
`----

,----
| 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 "👋")
|   (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
`----