spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / mods / diff / hooks / views / layout / pad-end / pad-end.ts
12 lines · 401 BRaw
1import { chargedWidth } from '../charged-width'
2
3/**
4 * A sanitized text with spaces after it up to a width in cells, counted by
5 * chargedWidth; unchanged when it is that wide already.
6 *
7 * @param text the text
8 * @param cells the width to reach
9 * @returns the padded text
10 */
11export const padEnd = (text: string, cells: number) =>
12 `${text}${' '.repeat(Math.max(0, cells - chargedWidth(text)))}`