Skip to content

Commit 9b730b2

Browse files
committed
Make RET in REPL create new prompt with blank input
This creates a new prompt that doesn't affect the history or send any information to the GHCi process. This only occurs when on the same line as the last prompt.
1 parent e54b254 commit 9b730b2

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

haskell-repl.el

+11-4
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,16 @@
2222

2323
(defun haskell-interactive-handle-expr ()
2424
"Handle an inputted expression at the REPL."
25-
(when (haskell-interactive-at-prompt)
26-
(let ((expr (haskell-interactive-mode-input)))
27-
(unless (string= "" (replace-regexp-in-string " " "" expr))
25+
(let ((expr (haskell-interactive-mode-input))
26+
(at-prompt-line (>= (line-end-position)
27+
haskell-interactive-mode-prompt-start)))
28+
(if (and at-prompt-line
29+
(string= "" (replace-regexp-in-string " " "" expr)))
30+
(progn
31+
(goto-char (point-max))
32+
(insert "\n")
33+
(haskell-interactive-mode-prompt))
34+
(when (haskell-interactive-at-prompt)
2835
(cond
2936
;; If already evaluating, then the user is trying to send
3037
;; input to the REPL during evaluation. Most likely in
@@ -37,7 +44,7 @@
3744
haskell-interactive-mode-result-end
3845
(point))))
3946
;; here we need to go to end of line again as evil-mode
40-
;; might hae managed to put us one char back
47+
;; might have managed to put us one char back
4148
(goto-char (point-max))
4249
(insert "\n")
4350
;; Bring the marker forward

0 commit comments

Comments
 (0)