try to take the autowrap bitmap into account when sizing the repl input box

This commit is contained in:
Robby Findler 2014-10-28 15:51:45 -05:00
parent 00a7eaca2c
commit fa413f14a9

View File

@ -2246,7 +2246,9 @@
scroll-to-position scroll-to-position
position-location position-location
get-styles-fixed get-styles-fixed
set-styles-fixed) set-styles-fixed
auto-wrap
get-autowrap-bitmap-width)
;; private field ;; private field
(define eventspace (current-eventspace)) (define eventspace (current-eventspace))
@ -2453,16 +2455,17 @@
(define/private (adjust-box-input-width) (define/private (adjust-box-input-width)
(when box-input (when box-input
(let ([w (box 0)] (define w (box 0))
[x (box 0)] (define x (box 0))
[bw (send (icon:get-eof-bitmap) get-width)]) (define bw (send (icon:get-eof-bitmap) get-width))
(get-view-size w #f) (get-view-size w #f)
(let ([pos (- (last-position) 2)]) (define pos (- (last-position) 2))
(position-location pos x #f #t (position-location pos x #f #t
(not (= pos (paragraph-start-position (position-paragraph pos)))))) (not (= pos (paragraph-start-position (position-paragraph pos)))))
(let ([size (- (unbox w) (unbox x) bw 24)]) (define auto-wrap-icon-size (get-autowrap-bitmap-width))
(when (positive? size) (define size (- (unbox w) (unbox x) bw 24 auto-wrap-icon-size))
(send box-input set-min-width size)))))) (when (positive? size)
(send box-input set-min-width size))))
(define/augment (on-display-size) (define/augment (on-display-size)
(adjust-box-input-width) (adjust-box-input-width)