MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / isPrintableAscii

Function isPrintableAscii

packages/pi-tui/src/utils.ts:51–59  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

49 /[\p{Script_Extensions=Han}\p{Script_Extensions=Hiragana}\p{Script_Extensions=Katakana}\p{Script_Extensions=Hangul}\p{Script_Extensions=Bopomofo}]/u;
50
51function isPrintableAscii(str: string): boolean {
52 for (let i = 0; i < str.length; i++) {
53 const code = str.charCodeAt(i);
54 if (code < 0x20 || code > 0x7e) {
55 return false;
56 }
57 }
58 return true;
59}
60
61function truncateFragmentToWidth(text: string, maxWidth: number): { text: string; width: number } {
62 if (maxWidth <= 0 || text.length === 0) {

Callers 3

truncateFragmentToWidthFunction · 0.85
visibleWidthFunction · 0.85
truncateToWidthFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected