File tree 1 file changed +14
-0
lines changed
1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -332,6 +332,7 @@ to continue it."
332
332
(setq comint-input-filter #'inf-clojure-input-filter )
333
333
(setq-local comint-prompt-read-only inf-clojure-prompt-read-only)
334
334
(add-hook 'comint-preoutput-filter-functions #'inf-clojure-preoutput-filter nil t )
335
+ (add-hook 'comint-output-filter-functions 'inf-clojure--ansi-filter )
335
336
(add-hook 'completion-at-point-functions #'inf-clojure-completion-at-point nil t )
336
337
(ansi-color-for-comint-mode-on ))
337
338
@@ -356,6 +357,19 @@ to continue it."
356
357
" Remove subprompts from STRING."
357
358
(replace-regexp-in-string inf-clojure-subprompt " " string))
358
359
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
+
359
373
(defun inf-clojure-preoutput-filter (str )
360
374
" Preprocess the output STR from interactive commands."
361
375
(cond
You can’t perform that action at this time.
0 commit comments