mirror of
https://github.com/TextPlace/CoreTextPlace.git
synced 2025-05-01 13:11:10 +00:00
Compare commits
No commits in common. "main" and "0.4.0" have entirely different histories.
3 changed files with 2 additions and 9 deletions
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@textplace/core",
|
"name": "@textplace/core",
|
||||||
"version": "0.4.1",
|
"version": "0.4.0",
|
||||||
"exports": "./mod.ts",
|
"exports": "./mod.ts",
|
||||||
"imports": {
|
"imports": {
|
||||||
"@deno/dnt": "jsr:@deno/dnt@^0.41.3",
|
"@deno/dnt": "jsr:@deno/dnt@^0.41.3",
|
||||||
|
|
|
@ -10,6 +10,5 @@ export function getCharacterWidth(ch: string): number {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Properly fix this.
|
return unicodeWidth(ch);
|
||||||
return Math.min(unicodeWidth(ch), 2);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,12 +32,6 @@ Deno.test("getCharacterWidth CJK", () => {
|
||||||
assertThrows(() => getCharacterWidth("ヨスガノ"));
|
assertThrows(() => getCharacterWidth("ヨスガノ"));
|
||||||
});
|
});
|
||||||
|
|
||||||
Deno.test("getCharacterWidth Emoji", () => {
|
|
||||||
assertEquals(getCharacterWidth("👋"), 2);
|
|
||||||
assertEquals(getCharacterWidth("🌲️"), 2);
|
|
||||||
assertEquals(getCharacterWidth("👨👩👧👦"), 2);
|
|
||||||
});
|
|
||||||
|
|
||||||
Deno.test("getCharacterWidth previously faulty cases", () => {
|
Deno.test("getCharacterWidth previously faulty cases", () => {
|
||||||
assertEquals(getCharacterWidth("𤲶"), 2);
|
assertEquals(getCharacterWidth("𤲶"), 2);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue