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 / detail / code-blocks-of / drawn-line-of / drawn-line-of.ts
15 lines · 559 BRaw
1import Layout from '../../../layout'
2
3/**
4 * A hunk line made safe for a `Code` source: its marker and its tabs kept,
5 * the engine laying tabs out as it does every diff it draws.
6 *
7 * Between the tabs sanitizeLine's rule holds: every control, format and
8 * invisible character dropped, so nothing can reorder or hide the line.
9 *
10 * @param line a body line, its `+`, `-` or space marker first
11 * @returns the drawable line
12 */
13export const drawnLineOf = (line: string) =>
14 line.slice(0, 1) +
15 line.slice(1).split('\t').map(Layout.sanitizeLine).join('\t')