Get the latest tech news

Show HN: wcwidth-o1 – Find Unicode text cell width in no time for JavaScript/TS


A TypeScript/JavaScript port of Markus Kuhn’s wcwidth. Faithfully clones the original implementation. - dawsonhuang0/Wcwidth-O1

In fixed-width terminals, most Latin characters take up one column, while East Asian (CJK) ideographs usually take up two. The challenge is deciding how many “cells” each Unicode character should occupy so that text aligns correctly. This logic originates from Markus Kuhn’s reference implementation and is widely used in terminal emulators to ensure consistent alignment.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Time

Time

Photo of width

width

Photo of JavaScript/TS

JavaScript/TS

Related news:

News photo

Scientists: It’s do or die time for America’s primacy exploring the Solar System: "When you turn off those spacecraft’s radio receivers, there's no way to turn them back on."

News photo

Wind and Solar Power Fuel Over One-Third of Brazil's Electricity For First Time

News photo

Don't expect that Netflix BioShock movie any time soon - three years on it still doesn't have a finished script