Skip to content

Commit e59ca6a

Browse files
committed
arrows can go off the bottom sometimes too, with expressions like this one:
(lambda (x) x) the tail arrow will curve down a bit so if that lambda is at the bottom of the window then it'll go outside the drawing area of the editor. In that case, just fall back to a straight arrow
1 parent 2571a56 commit e59ca6a

File tree

1 file changed

+14
-12
lines changed
  • drracket-core-lib/drracket/private/syncheck

1 file changed

+14
-12
lines changed

drracket-core-lib/drracket/private/syncheck/gui.rkt

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,8 +1182,9 @@ If the namespace does not, they are colored the unbound color.
11821182
(when (and canvas admin (not (is-printing?)))
11831183
(define hb (box 0))
11841184
(define wb (box 0))
1185-
(get-extent wb #f)
1185+
(get-extent wb hb)
11861186
(define max-width-for-arrow (unbox wb))
1187+
(define max-height-for-arrow (unbox hb))
11871188
(unless (zero? max-width-for-arrow)
11881189
(get-view-size wb hb)
11891190
(define-values (inset-x inset-y)
@@ -1194,13 +1195,13 @@ If the namespace does not, they are colored the unbound color.
11941195
;; the tacked arrows will draw differently
11951196
(define mouse-over-current-arrows-key
11961197
(vector dx dy
1197-
max-width-for-arrow
1198+
max-width-for-arrow max-height-for-arrow
11981199
(hash-copy current-matching-identifiers)
11991200
cursor-text
12001201
cursor-pos))
12011202
(send mouse-over-arrow-drawing handle-arrow-drawing
12021203
canvas dc dx dy inset-x inset-y (unbox wb) (unbox hb)
1203-
max-width-for-arrow
1204+
max-width-for-arrow max-height-for-arrow
12041205
this
12051206
mouse-over-current-arrows-key
12061207
(λ () (determine-the-mouse-over-arrows)))
@@ -1209,11 +1210,11 @@ If the namespace does not, they are colored the unbound color.
12091210
;; the mouse-over arrows will draw differently
12101211
(define tacked-over-current-arrows-key
12111212
(vector dx dy
1212-
max-width-for-arrow
1213+
max-width-for-arrow max-height-for-arrow
12131214
(hash-copy tacked-hash-table)))
12141215
(send tacked-arrow-drawing handle-arrow-drawing
12151216
canvas dc dx dy inset-x inset-y (unbox wb) (unbox hb)
1216-
max-width-for-arrow
1217+
max-width-for-arrow max-height-for-arrow
12171218
this
12181219
tacked-over-current-arrows-key
12191220
(λ () (determine-the-tacked-arrows))))))
@@ -2032,7 +2033,8 @@ If the namespace does not, they are colored the unbound color.
20322033

20332034
;; determine-the-arrows : -> (listof arrows-and-min-max-width?)
20342035
(define/public (handle-arrow-drawing canvas dc dx dy inset-x inset-y width height
2035-
max-width-for-arrow text current-arrows-key
2036+
max-width-for-arrow max-height-for-arrow
2037+
text current-arrows-key
20362038
determine-the-arrows)
20372039
(cond
20382040
[(equal? current-arrows-key bitmap-arrows-key)
@@ -2081,7 +2083,7 @@ If the namespace does not, they are colored the unbound color.
20812083
(define bdc (make-object bitmap-dc% arrows-bitmap))
20822084
(define next-state
20832085
(draw-the-arrows bdc (- dx inset-x) (- dy inset-y)
2084-
max-width-for-arrow
2086+
max-width-for-arrow max-height-for-arrow
20852087
arrows-and-min-max-widths))
20862088
(send bdc set-bitmap #f)
20872089
(match next-state
@@ -2105,7 +2107,7 @@ If the namespace does not, they are colored the unbound color.
21052107
;; if the result is done, all arrows are drawn without the time budget expiring
21062108
;; if the result is a list, it contains the arrows that
21072109
;; remain to be drawn; also, the time budget has expired
2108-
(define/private (draw-the-arrows dc dx dy max-width-for-arrow arrows-and-min-max-widths)
2110+
(define/private (draw-the-arrows dc dx dy max-width-for-arrow max-height-for-arrow arrows-and-min-max-widths)
21092111
(define old-brush (send dc get-brush))
21102112
(define old-pen (send dc get-pen))
21112113
(define old-font (send dc get-font))
@@ -2134,7 +2136,7 @@ If the namespace does not, they are colored the unbound color.
21342136
(send dc set-pen (get-tail-pen))
21352137
(send dc set-brush (if tacked? (get-tacked-tail-brush) (get-untacked-brush)))])
21362138
(draw-arrow2 ele
2137-
max-width-for-arrow dc dx dy
2139+
max-width-for-arrow max-height-for-arrow dc dx dy
21382140
#:x-min var-arrow-end-x-min
21392141
#:x-max var-arrow-end-x-max))
21402142

@@ -2186,7 +2188,7 @@ If the namespace does not, they are colored the unbound color.
21862188

21872189
(struct arrows-and-min-max-width (arrows var-arrow-end-x-min var-arrow-end-x-max tacked?))
21882190

2189-
(define (draw-arrow2 arrow max-width-for-arrow dc dx dy
2191+
(define (draw-arrow2 arrow max-width-for-arrow max-height-for-arrow dc dx dy
21902192
#:x-min [var-arrow-end-x-min #f]
21912193
#:x-max [var-arrow-end-x-max #f])
21922194
(define-values (start-x start-y end-x end-y) (get-arrow-poss arrow))
@@ -2230,9 +2232,9 @@ If the namespace does not, they are colored the unbound color.
22302232
;; just give up on the curved arrows in that case.
22312233
#:%age (if (and (number? %age) (not (<= -1 %age 1))) #f %age)
22322234
#:bb (list 0
2233-
#f
2235+
0
22342236
max-width-for-arrow
2235-
#f))
2237+
max-height-for-arrow))
22362238
(when (and (var-arrow? arrow) (not (var-arrow-actual? arrow)))
22372239
(define old-font (send dc get-font))
22382240
(send dc set-font

0 commit comments

Comments
 (0)