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

Function getTabWidth

src/components/TagTabs.tsx:30–38  ·  view source on GitHub ↗

* Calculate the display width of a tab

(tab: string, maxWidth?: number)

Source from the content-addressed store, hash-verified

28 * Calculate the display width of a tab
29 */
30function getTabWidth(tab: string, maxWidth?: number): number {
31 if (tab === ALL_TAB_LABEL) {
32 return ALL_TAB_LABEL.length + TAB_PADDING;
33 }
34 // For non-All tabs: " #{tag} " but truncate tag if needed
35 const tagWidth = stringWidth(tab);
36 const effectiveTagWidth = maxWidth ? Math.min(tagWidth, maxWidth - TAB_PADDING - HASH_PREFIX_LENGTH) : tagWidth;
37 return Math.max(0, effectiveTagWidth) + TAB_PADDING + HASH_PREFIX_LENGTH;
38}
39
40/**
41 * Truncate a tag to fit within maxWidth, accounting for padding and hash prefix

Callers

nothing calls this directly

Calls 1

maxMethod · 0.80

Tested by

no test coverage detected