Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return 2 for emoji width in the 0x2300-0x1f000 range if ambw=double #2074

Closed
wants to merge 1 commit into from

Conversation

mattn
Copy link
Member

@mattn mattn commented Sep 9, 2017

On current implementation, emoji characters in range 0x2300-0x1f000 is not listed which return 2 from utf_char2cells(). I know this is compatible issue.

#665

3848e00

6a08454

Now, I'm thinking that user who got the compatible issue should set ambiwidth=single. So I suggest to return 2 for the emoji characters in the range 0x2300-0x1f000, if ambiwidth=double.

If you don't like this, I can make patch to add new option or detect locale string is CJK.

@brammool
Copy link
Contributor

brammool commented Sep 9, 2017 via email

@mattn
Copy link
Member Author

mattn commented Sep 11, 2017

I get very confused about the 'emoji' option. The docs say:

When on all Unicode emoji characters are considered to be full width.

But then it only applies to the characters in emoji_width, not
emoji_all. Why doesn't it use emoji_all?

Then utf_ambiguous_width() returns true for all emoji characters, but
when 'amibwidth' is "double" this isn't taken into account.

Please remember this thread on mailing list.

https://groups.google.com/forum/#!searchin/vim_dev/Arrow$20characters$20shouldn$27t$20be$20wide%7Csort:relevance/vim_dev/fu0ZZIx5gjk/2-MOLugwGgAJ

6a08454

So what should be the proper behavior? Are there any characters in emoji_all that are always single width? The utf_ambiguous_width() needs to be ajusted.

Some of terminal still not be fixed to show emoji as square box. On such terminal, is drawn as narrow width. There are two types of terminal. One of them draw ↖ as narrow, Other one draw ↖ as wide. So we should provide way to switch them.

I thought for the way to fix this issue. And I guess the user who expect narrow width for ↖ should set ambiwidth=single.

@mattn
Copy link
Member Author

mattn commented Sep 11, 2017

However, I can not make sure that there are no side effects from my suggestion. So, if you do not like this change, I can prepare another option.

@brammool
Copy link
Contributor

brammool commented Sep 11, 2017 via email

@mattn
Copy link
Member Author

mattn commented Sep 12, 2017

Is it right to say that all emoji characters should be double width, but
in some fonts a subset is single width?

Sorry, my idea is bad. you are right. So it can't define with single option emoji. How about following ideas to correct this issue.

new function to define widths

let cells = {
\ "2139",
\ "2194-2199",
\ ...
\}
call setwcwidth(cells)

load cell-width list file

:loadwcwidthfile /path/to/wcwidth.txt

Should be list as same as above func.

override wcwidth by dll/so

int
my_wcwidth(int c) {
  return /* my custom width */
}

or

int
my_wcwidth(const char fontname, int c) {
  return /* my custom width */
}

@brammool
Copy link
Contributor

Is this PR going to be worked on or shall we close it?

@mattn
Copy link
Member Author

mattn commented Sep 30, 2019

I want still working on this.

@brammool
Copy link
Contributor

There is no progress on this, and also I don't see any issues being reported for emoji's. Therefore closing this. If you do have a known problem, please explain.

@brammool brammool closed this Jun 10, 2020
@mattn
Copy link
Member Author

mattn commented May 18, 2022

Ref: 08aac3c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i18n internationalization and/or localization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants