Stub out story/controls and use code-mirror with vim for text-editing

This commit is contained in:
Yura Dupyn 2026-02-13 20:06:43 +01:00
parent c255e19c42
commit 6a0f95812a
11 changed files with 383 additions and 44 deletions

View file

@ -7,6 +7,7 @@ import { SourceText, sourceText } from 'src/lang/parser/source_text';
import { ParseError, parseExpr } from 'src/lang/parser/parser';
import { ShowParseError } from './ParseError';
import { Val } from './Value';
import { CodeEditor } from './CodeEditor';
namespace ReplResult {
export type Idle =
@ -55,25 +56,15 @@ export function ExprREPL() {
return (
<section>
<textarea
placeholder="+(3, 4)"
rows="5"
value={input()}
onInput={(e) => setInput(e.currentTarget.value)}
onKeyDown={(e) => {
// Check for Enter + (Ctrl or Command for Mac)
if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
e.preventDefault(); // Stop the newline from being added
runExecution();
}
}}
<CodeEditor
value={input()}
onUpdate={setInput}
onRun={runExecution}
/>
<button onClick={runExecution}>Run</button>
<hr />
<div>
<div style={{ "margin-top": "1rem" }}>
<Switch>
<Match when={result().tag === "idle"}>
{ "" }