File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -332,6 +332,7 @@ to continue it."
332332 (setq comint-input-filter #'inf-clojure-input-filter )
333333 (setq-local comint-prompt-read-only inf-clojure-prompt-read-only)
334334 (add-hook 'comint-preoutput-filter-functions #'inf-clojure-preoutput-filter nil t )
335+ (add-hook 'comint-output-filter-functions 'inf-clojure--ansi-filter )
335336 (add-hook 'completion-at-point-functions #'inf-clojure-completion-at-point nil t )
336337 (ansi-color-for-comint-mode-on ))
337338
@@ -356,6 +357,19 @@ to continue it."
356357 " Remove subprompts from STRING."
357358 (replace-regexp-in-string inf-clojure-subprompt " " string))
358359
360+ (defconst inf-clojure--ansi-clear-line " \\ [1G\\ |\\ [0J\\ |\\ [13G"
361+ " Ansi codes sent by the lumo repl that we need to clear." )
362+
363+ (defun inf-clojure--ansi-filter (string )
364+ " Filter unwanted ansi character from STRING."
365+ (save-excursion
366+ ; ; go to start of first line just inserted
367+ (comint-goto-process-mark )
368+ (goto-char (max (point-min ) (- (point ) (string-width string))))
369+ (forward-line 0 )
370+ (while (re-search-forward inf-clojure--ansi-clear-line nil t )
371+ (replace-match " " ))))
372+
359373(defun inf-clojure-preoutput-filter (str )
360374 " Preprocess the output STR from interactive commands."
361375 (cond
You can’t perform that action at this time.
0 commit comments