Skip to content

Commit

Permalink
remove start-column
Browse files Browse the repository at this point in the history
  • Loading branch information
yitzchak committed Jan 23, 2024
1 parent 00ed3fa commit c1a79a8
Showing 1 changed file with 17 additions and 24 deletions.
41 changes: 17 additions & 24 deletions code/pretty-stream.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,6 @@
:type boolean)
(prefix-fragments :accessor prefix-fragments
:initform nil)
(start-column :accessor start-column
:initarg :start-column
:initform 0
:type real)
(indent :accessor indent
:initarg :indent
:initform nil
Expand Down Expand Up @@ -553,8 +549,8 @@
(unless (typep instruction 'literal-newline)
(add-advance-fragment stream mode instruction
(if *print-miser-width*
(start-column (parent instruction))
(+ (start-column (parent instruction))
(column (parent instruction))
(+ (column (parent instruction))
(indent (parent instruction)))))))
:break)))

Expand All @@ -569,7 +565,7 @@
(setf (indent (parent instruction))
(+ (width instruction)
(column instruction)
(- (start-column (parent instruction)))))
(- (column (parent instruction)))))
:no-break)

(defmethod layout (client stream (mode (eql :overflow-lines)) (instruction block-start))
Expand All @@ -583,24 +579,21 @@
(indent indent)
(parent parent)
(prefix-fragments prefix-fragments)
(start-column start-column)
(per-line-prefix-p per-line-prefix-p))
instruction
(let ((parent-prefix-fragments (and parent
(prefix-fragments parent))))
(setf start-column (+ column
(stream-measure-string (target stream)
(prefix instruction)))
indent 0)
(when (or per-line-prefix-p parent-prefix-fragments)
(setf prefix-fragments
(nconc (copy-seq parent-prefix-fragments)
(list column)
(when (and per-line-prefix-p
(not (zerop (length prefix))))
(list prefix)))))
(add-text-fragment stream mode instruction
(prefix instruction)))))
(let* ((orig-column column)
(result (add-text-fragment stream mode instruction prefix)))
(when result
(setf indent 0
prefix-fragments (copy-seq (and parent (prefix-fragments parent))))
(when (or prefix-fragments per-line-prefix-p)
(setf prefix-fragments
(nconc prefix-fragments
(list orig-column)
(when (and per-line-prefix-p
(not (zerop (length prefix))))
(list prefix))))))
result)))

(defmethod layout (client stream (mode (eql :overflow-lines)) (instruction block-end))
(add-text-fragment stream mode instruction (suffix instruction)))
Expand Down Expand Up @@ -865,7 +858,7 @@
(or (and current-tail
(column current-tail))
(and (blocks stream)
(start-column (car (blocks stream))))
(column (car (blocks stream))))
(ngray:stream-line-column (target stream))))

(defmethod ngray:stream-advance-to-column ((stream pretty-stream) column)
Expand Down

0 comments on commit c1a79a8

Please sign in to comment.