Stub out story/controls and use code-mirror with vim for text-editing
This commit is contained in:
parent
c255e19c42
commit
6a0f95812a
11 changed files with 383 additions and 44 deletions
|
|
@ -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"}>
|
||||
{ "" }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue