Skip to content

Commit

Permalink
Improve applying processing ansi color
Browse files Browse the repository at this point in the history
  • Loading branch information
syohex committed Jan 26, 2017
1 parent cdfd4b2 commit 5dc39e7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion quickrun.el
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,14 @@ if you set your own language configuration.
(process-send-region process (point-min) (point-max))
(process-send-eof process)))))

(defun quickrun--default-filter (proc output)
(with-current-buffer (process-buffer proc)
(read-only-mode -1)
(goto-char (point-max))
(let ((start (point)))
(insert output)
(ansi-color-apply-on-region start (point)))))

(defun quickrun/exec (cmd-lst src mode)
(if quickrun/run-in-shell
(quickrun/send-to-shell cmd-lst)
Expand All @@ -654,6 +662,8 @@ if you set your own language configuration.
(when (and (null rest-cmds) quickrun-input-file-extension)
(let ((file (quickrun/stdin-file-name)))
(quickrun/send-file-as-stdin process file)))
(when (eq outputter 'quickrun/default-outputter)
(set-process-filter process #'quickrun--default-filter))
(set-process-sentinel process
(quickrun/make-sentinel rest-cmds outputter src mode))))))

Expand Down Expand Up @@ -800,7 +810,6 @@ if you set your own language configuration.
(recenter arg)))

(defun quickrun/default-outputter ()
(ansi-color-apply-on-region (point-min) (point-max))
(quickrun/recenter -1))

(defun quickrun/outputter-multi-p (outputter)
Expand Down

0 comments on commit 5dc39e7

Please sign in to comment.