diff --git a/backend.lisp b/backend.lisp index aa07f6f192d3937f4739be913289f5700332738c..198289a92d88f3ea84dbb1416487b225373b8a56 100644 --- a/backend.lisp +++ b/backend.lisp @@ -23,6 +23,10 @@ (defparameter *default-columns* 80) (defparameter *default-lines* 24) +(defparameter *highlight-color* :green + "Color to use for highlighting parentheses. NIL is the current foreground +color bolded, other options are :BLACK, :RED, :GREEN, :YELLOW, :BLUE, +:MAGENTA, :CYAN, and :WHITE.") (defclass backend () ((ready-p :accessor backend-ready-p :initform nil) diff --git a/linedit.asd b/linedit.asd index 8589584211f79da5077980059264a68428350302..c1f4e6e653c1a7557c051ce6990ca9a620b15c0a 100644 --- a/linedit.asd +++ b/linedit.asd @@ -59,7 +59,7 @@ (error 'operation-error :component c :operation o))) (defsystem :linedit - :version "0.17.3" + :version "0.17.4" :description "Readline-style library." :licence "MIT" :author "Nikodemus Siivola " diff --git a/packages.lisp b/packages.lisp index 91764e6d47c728e5e2c670f6a4758cb119974da0..7d782e051c907ab72502fb492a3647414edc7b07 100644 --- a/packages.lisp +++ b/packages.lisp @@ -28,6 +28,7 @@ #:formedit #:*default-columns* #:*default-lines* + #:*highlight-color* #:install-repl #:uninstall-repl #:start-debug diff --git a/smart-terminal.lisp b/smart-terminal.lisp index e219626c56e020d951937a16d6907f38f6eb338c..f30d9373cdefe2454cb895b058b5e0eb9f47fae0 100644 --- a/smart-terminal.lisp +++ b/smart-terminal.lisp @@ -72,6 +72,15 @@ (loop repeat up do (ti:tputs ti:cursor-up)) (ti:tputs ti:column-address col)) +(defun paren-style () + (concat + (when *highlight-color* + (ti:tparm + ti:set-a-foreground + (or (position *highlight-color* '(:black :red :green :yellow :blue :magenta :cyan :white)) + (error "Unknown color: ~S" *highlight-color*)))) + ti:enter-bold-mode)) + (defmethod display ((backend smart-terminal) &key prompt line point markup) (let* (;; SBCL and CMUCL traditionally point *terminal-io* to /dev/tty, ;; and we do output on it assuming it goes to STDOUT. Binding @@ -94,8 +103,8 @@ old-row 1)) (multiple-value-bind (marked-line markup) (if markup - (dwim-mark-parens line point - :pre-mark ti:enter-bold-mode + (dwim-mark-parens line point + :pre-mark (paren-style) :post-mark ti:exit-attribute-mode) (values line point)) (let* ((full (concat prompt marked-line))