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

Squares ▪︎▫︎◻︎◼︎ and arrows ◀︎▶︎ reported with width 2 but only takes up 1 space #2

Closed
erf opened this issue Mar 30, 2023 · 3 comments

Comments

@erf
Copy link

erf commented Mar 30, 2023

Squares ▪︎▫︎◻︎◼︎ and arrows ◀︎▶︎ reported with width 2 but only takes up 1 space in the terminal.

There are probably more cases like this. i Pressed the "Character viewer" on my mac and went to "Bullets and stars" to find these.

@hyiso
Copy link
Owner

hyiso commented Apr 4, 2023

Emoji Regex related issue could be fired to emoji_regex.
string_width@0.1.4 use a copy of emoji_regex.dart temporarily and will remove it later

@hyiso hyiso closed this as not planned Won't fix, can't repro, duplicate, stale Apr 4, 2023
@erf
Copy link
Author

erf commented Apr 4, 2023

I see you replace all emoji characters with two empty spaces, is that correct though for all emoji characters? The square and arrow symbols i mentioned only took up one space, so if these are emojis as you suggest, then they would take up two spaces, but that would be wrong.

@erf
Copy link
Author

erf commented Apr 4, 2023

I wrote a test and found the Unicode character for the black square, which is in fact part of the emoji_regex and is replaced with two empty chars, gives 2 in width, but in the terminals i've tested in it only takes up one column space.

import 'package:string_width/string_width.dart';
import 'package:test/test.dart';

void main() {
  test('measure string width of ▪', () {
    expect(stringWidth('▪'), 1);
  });
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants