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

Function resolveStackCellGeometry

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

Source from the content-addressed store, hash-verified

110
111/** Resolve the stack-cell gutter and code viewport after the left rail prefix. */
112export function resolveStackCellGeometry(
113 width: number,
114 lineNumberDigits: number,
115 showLineNumbers: boolean,
116 prefixWidth = DIFF_RAIL_PREFIX_WIDTH,
117) {
118 const availableWidth = Math.max(0, width - prefixWidth);
119 const gutterWidth = Math.min(availableWidth, showLineNumbers ? lineNumberDigits * 2 + 5 : 2);
120
121 return {
122 gutterWidth,
123 contentWidth: Math.max(0, availableWidth - gutterWidth),
124 };
125}
126
127/** Clamp horizontal reveal against the narrowest code viewport in the active layout. */
128export function resolveCodeViewportWidth(

Callers 7

renderCopySelectionTextFunction · 0.90
expandSelectionPointFunction · 0.90
buildWrappedStackCellFunction · 0.90
buildPlainStackCellLinesFunction · 0.90
renderStackCellFunction · 0.90
resolveCodeViewportWidthFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected