From: Eli Zaretskii <eliz@gnu.org>
To: Adam Niederer <adam.niederer@gmail.com>
Cc: 27403@debbugs.gnu.org
Subject: bug#27403: 26.0.50; Indentation misalignment with Unicode code points >65535
Date: Sat, 17 Jun 2017 11:05:19 +0300 [thread overview]
Message-ID: <83tw3fyr7k.fsf@gnu.org> (raw)
In-Reply-To: <5bd704e4-b3e4-bcd3-eea6-66856fc47dd6@gmail.com> (message from Adam Niederer on Sat, 17 Jun 2017 02:28:41 -0400)
> From: Adam Niederer <adam.niederer@gmail.com>
> Date: Sat, 17 Jun 2017 02:28:41 -0400
>
> Hello, I believe I've found an indentation issue. To reproduce, start
> emacs, create a buffer in js-mode, paste in this code, and press C-x h
> TAB to indent the buffer:
>
> let x = /* 👍 */ { foo: 0
> bar: 0 }
>
> let x = /* ☺ */ { foo: 0
> bar: 0 }
>
> Both 25.2 and 26.0.50 add one extra space before "bar" in the first
> first snippet with U+1F44D THUMBS UP SIGN in the comment, whereas the
> second snippet with U+263A WHITE SMILING FACE properly aligns "bar" with
> "foo".
That's because U+1F44D is a double-width character:
(char-width ?👍) => 2
while U+263A is not double-width.
So as long as indentation works in columns and not in pixels, this is
a "feature".
> This appears to happen whenever the character in the comment needs a
> surrogate pair.
I don't believe surrogates have anything to do with this, since Emacs
works with Unicode codepoints, not their UTF-16 encodings.
> Interestingly, pressing TAB with one's point on the second line of each
> snippet to dedent the line yields a correct result for both symbols:
>
> "👍", {"a": 2,
> "b": 3}
>
> "☺", {"a":2,
> "b":3}
Which is probably a subtle bug: this should behave like the first
snippet.
Thanks.
next prev parent reply other threads:[~2017-06-17 8:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-17 6:28 bug#27403: 26.0.50; Indentation misalignment with Unicode code points >65535 Adam Niederer
2017-06-17 7:18 ` Andreas Schwab
2017-06-17 8:05 ` Eli Zaretskii [this message]
2017-06-17 8:24 ` Andreas Schwab
2017-06-17 10:28 ` Eli Zaretskii
2017-06-17 12:09 ` Andreas Schwab
2017-06-17 13:39 ` Eli Zaretskii
2017-06-17 18:07 ` Andreas Schwab
2017-06-17 18:21 ` Eli Zaretskii
2022-02-03 20:25 ` Lars Ingebrigtsen
2022-02-04 7:05 ` Eli Zaretskii
2022-02-05 6:40 ` Lars Ingebrigtsen
2022-02-05 7:51 ` Eli Zaretskii
2022-02-05 7:55 ` Lars Ingebrigtsen
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=83tw3fyr7k.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=27403@debbugs.gnu.org \
--cc=adam.niederer@gmail.com \
/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).