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

Function resolveCodeViewportWidth

src/ui/diff/codeColumns.ts:128–143  ·  view source on GitHub ↗
(
  layout: Exclude<LayoutMode, "auto">,
  width: number,
  lineNumberDigits: number,
  showLineNumbers: boolean,
)

Source from the content-addressed store, hash-verified

126
127/** Clamp horizontal reveal against the narrowest code viewport in the active layout. */
128export function resolveCodeViewportWidth(
129 layout: Exclude<LayoutMode, "auto">,
130 width: number,
131 lineNumberDigits: number,
132 showLineNumbers: boolean,
133) {
134 if (layout === "split") {
135 const { leftWidth, rightWidth } = resolveSplitPaneWidths(width);
136 return Math.min(
137 resolveSplitCellGeometry(leftWidth, lineNumberDigits, showLineNumbers).contentWidth,
138 resolveSplitCellGeometry(rightWidth, lineNumberDigits, showLineNumbers).contentWidth,
139 );
140 }
141
142 return resolveStackCellGeometry(width, lineNumberDigits, showLineNumbers).contentWidth;
143}

Callers 1

AppFunction · 0.90

Calls 3

resolveSplitPaneWidthsFunction · 0.85
resolveSplitCellGeometryFunction · 0.85
resolveStackCellGeometryFunction · 0.85

Tested by

no test coverage detected