stream-advance-to-column not used

Bug #1591930 reported by Tomas Zellerin
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
SBCL
New
Undecided
Unassigned

Bug Description

I define new subclass of fundamental-character-output-stream, and method sb-gray:stream-advance-to-column for it.

SBCL user manual says "This is intended for use by by pprint and format ~T." about the method (actually, this looks copied out as-is from gray streams specification). I call (format (make-instance 'tab-stream) "~8T") on the new class and I expect the method to be called; however, spaces are written instead.

In the sources I have at hand (1.3.3), formatter expands "~T" to sb-format::format-absolute-tab/format-relative-tab that call output-spaces; I can try to make a draft patch if it is agreed that this is indeed a bug and that the correct place to fix it is there; I am a bit lost in how the pretty printing related tab enqueuing, so I might have misdiagnosed the correct place or have a too simplistic view.

Observed on Windows with sbcl 1.3.3 as well as on Linux with sbcl 1.3.6, I can provide Linux uname and *features* at both if needed, but I do not think it is dependent on it.

Full test case:

(defclass tab-stream (sb-gray:fundamental-character-output-stream)
  ())

(defmethod sb-gray:stream-advance-to-column ((s tab-stream) col)
  (break "Do advance column") ;; <- I expect this break to be invoked
  t)

(defmethod sb-gray:stream-line-column ((s tab-stream))
  (format *standard-output* "Asked for column~%")
  0)

(defmethod sb-gray:stream-write-char ((s tab-stream) char)
  ;; Must be defined
  (format *standard-output* "Out: ~:c~%" char))

format (make-instance 'tab-stream) "~8T")

=>
Asked for column
Out: Space
Out: Space
Out: Space
Out: Space
Out: Space
Out: Space
Out: Space
Out: Space

Tags: printer
tags: added: printer
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.