defstruct: no newline between name & fields if no fields
If a struct has no fields, don't check if a struct's name + first field's name are too long to print on one line Bug report: https://groups.google.com/forum/#!topic/racket-users/6fKGky4tud8
This commit is contained in:
parent
049bf4b07a
commit
d92b1829d5
|
@ -857,6 +857,7 @@
|
||||||
(short-width . < . max-proto-width))]
|
(short-width . < . max-proto-width))]
|
||||||
[split-field-line?
|
[split-field-line?
|
||||||
;; start fields on the line after "struct"?
|
;; start fields on the line after "struct"?
|
||||||
|
(and (pair? fields)
|
||||||
(max-proto-width . < . (+ 8
|
(max-proto-width . < . (+ 8
|
||||||
(if (pair? name)
|
(if (pair? name)
|
||||||
(+ (sym-length (car name))
|
(+ (sym-length (car name))
|
||||||
|
@ -864,10 +865,8 @@
|
||||||
(sym-length (cadr name)))
|
(sym-length (cadr name)))
|
||||||
(sym-length name))
|
(sym-length name))
|
||||||
1
|
1
|
||||||
(if (pair? fields)
|
|
||||||
(sym-length (field-name (car fields)))
|
(sym-length (field-name (car fields)))
|
||||||
0)
|
1)))])
|
||||||
1))])
|
|
||||||
(make-table
|
(make-table
|
||||||
#f
|
#f
|
||||||
;; First four columns: "(struct" <space> <name><space> (
|
;; First four columns: "(struct" <space> <name><space> (
|
||||||
|
|
|
@ -90,6 +90,8 @@ A function, again, not a link target, documented to return @racket[10] using a d
|
||||||
|
|
||||||
@defstruct[#:link-target? #f pt ([x real?] [y real?]) #:mutable]{A mutable structure type with extra name, again.}
|
@defstruct[#:link-target? #f pt ([x real?] [y real?]) #:mutable]{A mutable structure type with extra name, again.}
|
||||||
|
|
||||||
|
@defstruct[a-struct-with-an-extremely-long-name-and-no-fields ()]{Used to raise error, taking car of empty fields list. Reported by Carlos Lopez, 2017-03-11.}
|
||||||
|
|
||||||
|
|
||||||
@defmodule["manual-ex0.rkt" #:no-declare #:link-target? #f #:packages ()]
|
@defmodule["manual-ex0.rkt" #:no-declare #:link-target? #f #:packages ()]
|
||||||
@defmodule["manual-ex0.rkt" #:lang #:no-declare #:link-target? #f #:packages ()]
|
@defmodule["manual-ex0.rkt" #:lang #:no-declare #:link-target? #f #:packages ()]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user