diff --git a/src/code-view/internal.tsx b/src/code-view/internal.tsx index 9e0b212..fc67c26 100644 --- a/src/code-view/internal.tsx +++ b/src/code-view/internal.tsx @@ -16,6 +16,10 @@ const ACE_CLASSES = { light: "ace-cloud_editor", dark: "ace-cloud_editor_dark" } // Static props objects to avoid recreation on every render. const REGION_PROPS = { role: "region" } as const; const NO_REGION_PROPS = {} as const; +const SHRINK_COL_STYLE = { width: 1 } as const; +const AUTO_COL_STYLE = { width: "auto" } as const; + +const lineNumberClassName = clsx(styles["line-number"], styles.unselectable); type InternalCodeViewProps = CodeViewProps & InternalBaseComponentProps; @@ -57,6 +61,10 @@ export function InternalCodeView({ // Memoize tokenized React nodes to avoid re-running highlight on every render. const code = useMemo(() => (highlight ? highlight(content) : textHighlight(content)), [content, highlight]); const codeElement = Children.only(code) as ReactElement; + const codeLineClassName = clsx( + codeElement.props.className, + wrapLines ? styles["code-line-wrap"] : styles["code-line-nowrap"], + ); return (