X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fpprint.lisp;h=5032ecb699b7033fa1e9870aec42534154fe0b64;hb=1f7bb609de31bba1a85817496ecbde52a07edf14;hp=bc3dc844f1e97546d1a3b249d99f7bc3bb0b75b4;hpb=c0ea1cc4a9f928184b7a7ee65c396b79f1b9ff45;p=sbcl.git diff --git a/src/code/pprint.lisp b/src/code/pprint.lisp index bc3dc84..5032ecb 100644 --- a/src/code/pprint.lisp +++ b/src/code/pprint.lisp @@ -364,21 +364,23 @@ ;;;; tab support (defun compute-tab-size (tab section-start column) - (let ((origin (if (tab-sectionp tab) section-start 0)) - (colnum (tab-colnum tab)) - (colinc (tab-colinc tab))) + (let* ((origin (if (tab-sectionp tab) section-start 0)) + (colnum (tab-colnum tab)) + (colinc (tab-colinc tab)) + (position (- column origin))) (cond ((tab-relativep tab) (unless (<= colinc 1) - (let ((newposn (+ column colnum))) + (let ((newposn (+ position colnum))) (let ((rem (rem newposn colinc))) (unless (zerop rem) (incf colnum (- colinc rem)))))) colnum) - ((<= column (+ colnum origin)) - (- (+ colnum origin) column)) - (t + ((< position colnum) + (- colnum position)) + ((zerop colinc) 0) + (t (- colinc - (rem (- column origin) colinc)))))) + (rem (- position colnum) colinc)))))) (defun index-column (index stream) (let ((column (pretty-stream-buffer-start-column stream)) @@ -689,15 +691,15 @@ #!+sb-doc "Specify the indentation to use in the current logical block if STREAM (which defaults to *STANDARD-OUTPUT*) is it is a pretty-printing stream - and do nothing if not. (See PPRINT-LOGICAL-BLOCK.) N is the indention + and do nothing if not. (See PPRINT-LOGICAL-BLOCK.) N is the indentation to use (in ems, the width of an ``m'') and RELATIVE-TO can be either: :BLOCK - Indent relative to the column the current logical block started on. :CURRENT - Indent relative to the current column. - The new indention value does not take effect until the following line + The new indentation value does not take effect until the following line break." (declare (type (member :block :current) relative-to) - (type integer n) + (type real n) (type (or stream (member t nil)) stream) (values null)) (let ((stream (case stream @@ -705,7 +707,7 @@ ((nil) *standard-output*) (t stream)))) (when (print-pretty-on-stream-p stream) - (enqueue-indent stream relative-to n))) + (enqueue-indent stream relative-to (truncate n)))) nil) (defun pprint-tab (kind colnum colinc &optional stream)