MCPcopy Create free account
hub / github.com/modem-dev/hunk / resolveSplitCellGeometry

Function resolveSplitCellGeometry

src/ui/diff/codeColumns.ts:96–109  ·  view source on GitHub ↗
(
  width: number,
  lineNumberDigits: number,
  showLineNumbers: boolean,
  prefixWidth = DIFF_RAIL_PREFIX_WIDTH,
)

Source from the content-addressed store, hash-verified

94
95/** Resolve the split-cell gutter and code viewport after the rail prefix. */
96export function resolveSplitCellGeometry(
97 width: number,
98 lineNumberDigits: number,
99 showLineNumbers: boolean,
100 prefixWidth = DIFF_RAIL_PREFIX_WIDTH,
101) {
102 const availableWidth = Math.max(0, width - prefixWidth);
103 const gutterWidth = Math.min(availableWidth, showLineNumbers ? lineNumberDigits + 3 : 2);
104
105 return {
106 gutterWidth,
107 contentWidth: Math.max(0, availableWidth - gutterWidth),
108 };
109}
110
111/** Resolve the stack-cell gutter and code viewport after the left rail prefix. */
112export function resolveStackCellGeometry(

Callers 7

renderStaticSplitCellFunction · 0.90
renderCopySelectionTextFunction · 0.90
expandSelectionPointFunction · 0.90
buildWrappedSplitCellFunction · 0.90
buildPlainSplitCellLinesFunction · 0.90
renderSplitCellFunction · 0.90
resolveCodeViewportWidthFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected