Skip to content

Commit e927811

Browse files
committed
select whole REPL input after evaluate instead of clear
1 parent 3de47ca commit e927811

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Main.hs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ foreign import javascript unsafe "$1.value"
3030
foreign import javascript unsafe "$1.value = $2"
3131
js_input_set_value :: JSVal -> JSString -> IO ()
3232

33+
foreign import javascript unsafe "$1.select()"
34+
js_input_select :: JSVal -> IO ()
35+
3336
foreign import javascript unsafe "$1.key"
3437
js_event_key :: JSVal -> IO JSString
3538

@@ -83,6 +86,11 @@ clearREPL = do
8386
exprIn <- js_document_getElementById (toJSString "expr")
8487
js_input_set_value exprIn (toJSString "")
8588

89+
selectREPL :: IO ()
90+
selectREPL = do
91+
exprIn <- js_document_getElementById (toJSString "expr")
92+
js_input_select exprIn
93+
8694
-- | Handle evaluation request.
8795
handleEval :: RefState -> IO ()
8896
handleEval ref = do
@@ -98,7 +106,7 @@ handleEval ref = do
98106
result <- eval ref expr
99107
logHistory result
100108

101-
clearREPL
109+
selectREPL
102110

103111
-- | Put an item in the interpreter history.
104112
logHistory :: String -> IO ()

0 commit comments

Comments
 (0)