Skip to content

Commit

Permalink
ProgramView: prevent code from wrapping and use scrolling instead
Browse files Browse the repository at this point in the history
  • Loading branch information
MrTipson committed Mar 11, 2024
1 parent 1102fbf commit f351043
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/HeapView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export default function HeapView({ className, machine }: { className?: string, m
width: 100 + 40 * numVals,
height: 100
}
}).filter<Node>((x):x is Node => Boolean(x)); // When stepping back, some nodes become undefined. This filters them out
}).filter<Node>((x): x is Node => Boolean(x)); // When stepping back, some nodes become undefined. This filters them out
const layouted = getLayoutedElements(nodes, edges);

return (
Expand Down
8 changes: 4 additions & 4 deletions src/components/ProgramView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,14 @@ export default function ProgramView({ className, machine, setMachine, setStep, l
</Popover>
</div>
<Separator />
<div className={"relative grow m-2 overflow-y-auto"}>
<div className="h-max relative m-2">
<div className="relative grow m-2 overflow-y-auto p-2 flex flex-col">
<div className="relative w-full min-w-max grow">
<pre className={"relative z-10 bg-transparent selection:bg-accent" + (loaded ? "" : " pointer-events-none")}>{highlighted}</pre>
<code>
<textarea className={"absolute inset-0 bg-transparent text-transparent caret-primary p-4 font-semibold \
resize-none selection:bg-accent selection:text-transparent w-full h-full overflow-visible" + (!loaded ? "" : " pointer-events-none")}
resize-none selection:bg-accent selection:text-transparent w-full h-full overflow-hidden text-nowrap whitespace-pre" + (!loaded ? "" : " pointer-events-none")}
onChange={inputHandler} value={programText} spellCheck={false} disabled={loaded} />
</code>
<pre className={"relative z-10 bg-transparent text-wrap selection:bg-accent" + (loaded ? "" : " pointer-events-none")}>{highlighted}</pre>
</div>
</div>
</div>
Expand Down

0 comments on commit f351043

Please sign in to comment.