|
568 | 568 | (to-flow ((arg->elem #f) (car args) (next-args-depth (cdr args)))) |
569 | 569 | not-end) |
570 | 570 | (list* 'cont 'cont not-end))) |
571 | | - (let loop ([args (if one-ok? (cdr args) args)]) |
| 571 | + (let loop ([args (if one-ok? (cdr args) args)] [prev-depth (if one-ok? (arg-depth (car args)) 0)]) |
572 | 572 | (cond |
573 | 573 | [(null? args) null] |
574 | 574 | [else |
|
577 | 577 | (arg-special? (cadr args)) |
578 | 578 | (not (eq? '_...superclass-args... |
579 | 579 | (arg-id (cadr args))))))) |
| 580 | + (define (combine-for-depth left opt arg end) |
| 581 | + (if ((arg-depth (car args)) . < . prev-depth) |
| 582 | + ;; when a curried agument starts on a new line, |
| 583 | + ;; don't intent like non-curried arguments |
| 584 | + (list* (to-flow (list spacer |
| 585 | + (if (arg-starts-optional? (car args)) |
| 586 | + opt |
| 587 | + null) |
| 588 | + arg)) |
| 589 | + 'cont |
| 590 | + 'cont |
| 591 | + end) |
| 592 | + (list* left |
| 593 | + (to-flow opt) |
| 594 | + (to-flow arg) |
| 595 | + end))) |
580 | 596 | (cons |
581 | | - (list* |
| 597 | + (combine-for-depth |
582 | 598 | (if (eq? mode 'new) |
583 | 599 | (flow-spacer/n 3) |
584 | 600 | flow-spacer) |
585 | 601 | (if (arg-starts-optional? (car args)) |
586 | | - (to-flow (make-element #f (list spacer (racketoptionalfont "[")))) |
587 | | - flow-spacer) |
| 602 | + (make-element #f (list spacer (racketoptionalfont "["))) |
| 603 | + spacer) |
588 | 604 | (let ([a ((arg->elem #f) (car args) (next-args-depth (cdr args)))] |
589 | 605 | [next (if dots-next? |
590 | 606 | (make-element |
|
593 | 609 | (cadr args) |
594 | 610 | (next-args-depth (cddr args))))) |
595 | 611 | "")]) |
596 | | - (to-flow |
597 | | - (cond |
598 | | - [(null? ((if dots-next? cddr cdr) args)) |
599 | | - (make-element |
600 | | - #f |
601 | | - (list a next (racketparenfont ")")))] |
602 | | - [(equal? next "") a] |
603 | | - [else |
604 | | - (make-element #f (list a next))]))) |
| 612 | + (cond |
| 613 | + [(null? ((if dots-next? cddr cdr) args)) |
| 614 | + (make-element |
| 615 | + #f |
| 616 | + (list a next (racketparenfont ")")))] |
| 617 | + [(equal? next "") a] |
| 618 | + [else |
| 619 | + (make-element #f (list a next))])) |
605 | 620 | (if (and (null? ((if dots-next? cddr cdr) args)) |
606 | 621 | (not result-next-line?)) |
607 | 622 | end |
608 | 623 | not-end)) |
609 | 624 | (loop ((if dots-next? cddr cdr) |
610 | | - args)))])))))]))))) |
| 625 | + args) |
| 626 | + (max prev-depth (arg-depth (car args)))))])))))]))))) |
611 | 627 | (if result-next-line? |
612 | 628 | (list (list (make-flow (top-align |
613 | 629 | make-table-if-necessary |
|
0 commit comments