mirror of
https://github.com/TextPlace/CoreTextPlace.git
synced 2026-01-15 01:42:34 +00:00
This commit is contained in:
parent
d53e627440
commit
8746ae1494
3 changed files with 5 additions and 3 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@textplace/core",
|
"name": "@textplace/core",
|
||||||
"version": "0.6.0",
|
"version": "0.6.1",
|
||||||
"exports": "./src/mod.ts",
|
"exports": "./src/mod.ts",
|
||||||
"imports": {
|
"imports": {
|
||||||
"@std/cli": "jsr:@std/cli@1"
|
"@std/cli": "jsr:@std/cli@1"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@textplace/core",
|
"name": "@textplace/core",
|
||||||
"version": "0.6.0",
|
"version": "0.6.1",
|
||||||
"description": "The core logic of TextPlace.",
|
"description": "The core logic of TextPlace.",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import { unicodeWidth } from "@std/cli/unicode-width";
|
import { unicodeWidth } from "@std/cli/unicode-width";
|
||||||
|
|
||||||
const segmenter = new Intl.Segmenter("en", { granularity: "grapheme" });
|
const segmenter = /*#__PURE__*/ new Intl.Segmenter("en", {
|
||||||
|
granularity: "grapheme",
|
||||||
|
});
|
||||||
|
|
||||||
export function getCharacterWidth(ch: string): number {
|
export function getCharacterWidth(ch: string): number {
|
||||||
const segments = [...segmenter.segment(ch)];
|
const segments = [...segmenter.segment(ch)];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue