💡 Expose display-width helpers (stringWidth / charWidth)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 68/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- c, typescript, wasm
- Ambito
- api, cli, computer-graphics
Direzione di ricerca
Inizia con mod.ts e test/string-width.test.ts, poi esamina la tabella esistente in src/wcwidth.h e le impostazioni di esportazione wasm in Makefile:12. Usa il test e il diff collegati di string-width per comprendere il comportamento previsto, incluse le sequenze ANSI e i codepoint; il lavoro è completato quando gli helper di width sono esposti pubblicamente e il test passa.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is your feature request related to a problem?
The C layer already measures the display width of a character and of a whole string—it's how text gets laid out—but that isn't surfaced to consumers. There are real use cases for measuring text JS-side (truncating to a column budget, padding or aligning labels) with no way to do it today short of a throwaway render.
Describe the solution you'd like
Expose two pure helpers (exact names TBD), backed by the internal wcwidth table:
charWidth(0x4f60); // 2 (CJK)
stringWidth("你好"); // 4
charWidth returns 0/1/2; stringWidth sums codepoints with proper handling for ANSI escape sequences.
Describe alternatives you've considered
Add a JS-side width dependency (duplicates the table we already ship and can drift to a different Unicode version than layout uses), or render into a fit element and read back info.get(id).bounds.width (slow, and gets VS16 emoji clusters wrong).
Additional context
Failing test case on nm/repro/string-width (test · diff). The table is already in C (src/wcwidth.h:8) and exported from the wasm (Makefile:12, --export-all); this is mostly surfacing it from mod.ts.
- Lingua principale
- TypeScript
- Stelle
- 42
- Fork
- 2
- Merge medio
- 2g 5h
- PR unite (30g)
- 12
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di bombshell-dev/tty
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
bombshell-dev/tty#61 · 1 reazione ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
bombshell-dev/tty#129 ·
-
question
Difficoltà 5/5 Più di una settimana Idoneità per principianti 38/100
bombshell-dev/tty#112 ·
-
enhancement high priority
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
bombshell-dev/tty#83 · 2 commenti ·
-
enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
bombshell-dev/tty#82 ·
Tutte le issue di bombshell-dev/tty
Issue simili
-
blocklist removal
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
MetaMask/eth-phishing-detect#296544 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
pastelsky/bundlephobia#1122 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
category/development priority/P2 scope/file-operations scope/testing type/enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100