MCPcopy Index your code
hub / github.com/codeaashu/claude-code / truncateTag

Function truncateTag

src/components/TagTabs.tsx:43–53  ·  view source on GitHub ↗

* Truncate a tag to fit within maxWidth, accounting for padding and hash prefix

(tag: string, maxWidth: number)

Source from the content-addressed store, hash-verified

41 * Truncate a tag to fit within maxWidth, accounting for padding and hash prefix
42 */
43function truncateTag(tag: string, maxWidth: number): string {
44 // Available space for the tag text itself: maxWidth - " #" - " "
45 const availableForTag = maxWidth - TAB_PADDING - HASH_PREFIX_LENGTH;
46 if (stringWidth(tag) <= availableForTag) {
47 return tag;
48 }
49 if (availableForTag <= 1) {
50 return tag.charAt(0);
51 }
52 return truncateToWidth(tag, availableForTag);
53}
54export function TagTabs({
55 tabs,
56 selectedIndex,

Callers 1

TagTabsFunction · 0.85

Calls 1

truncateToWidthFunction · 0.85

Tested by

no test coverage detected