small fix to editing in chatter

svn: r15479
This commit is contained in:
Matthias Felleisen 2009-07-17 18:25:34 +00:00
parent a6312e8050
commit ca8385045f

View File

@ -212,15 +212,30 @@
(define (receive w m) (define (receive w m)
(make-world (world-todraft w) (make-world (world-todraft w)
(world-mmdraft w) (world-mmdraft w)
(enqueue (world-from w) (first m) (second m)) (enqueue 2 (world-from w) (first m) (second m))
(world-to w))) (world-to w)))
;; [Listof Line] String String -> [Listof Line] ;
;
; ;; ;
; ;
; ; ;;; ;; ;; ;;; ;;; ;; ;; ;; ;;
; ; ; ;; ; ; ; ; ; ; ; ; ;
; ; ; ; ; ;;;;; ;;;; ; ; ;;
; ; ; ; ; ; ; ; ; ; ;;
; ; ; ; ; ; ; ; ; ;; ; ;
; ;;;;; ;;;;; ;;; ;;; ;;;; ;;;;; ;; ;;;; ;;
;
;
;
;
;; Nat [Listof Line] String String -> [Listof Line]
;; generative: add the line at end of list; if small enough, okay. ;; generative: add the line at end of list; if small enough, okay.
;; this tests adding one too many items to the list ;; this tests adding one too many items to the list
(check-expect (check-expect
(enqueue (build-list 11 (lambda (i) (make-messg "a*" (number->string i)))) (enqueue 2 (build-list 11 (lambda (i) (make-messg "a*" (number->string i))))
"ada" "hello world") "ada" "hello world")
(build-list 11 (lambda (i) (build-list 11 (lambda (i)
(if (<= i 9) (if (<= i 9)
@ -228,12 +243,12 @@
(make-messg "ada" "hello world"))))) (make-messg "ada" "hello world")))))
(define (enqueue from* from msg) (define (enqueue h from* from msg)
(local ((define candidate (append from* (list (make-messg from msg)))) (local ((define candidate (append from* (list (make-messg from msg))))
(define rendered (line*-render candidate))) (define rendered (line*-render candidate)))
(cond (cond
[(<= (image-height rendered) (- MID 2)) candidate] [(<= (image-height rendered) (- MID h)) candidate]
[else (enqueue (rest from*) from msg)]))) [else (enqueue h (rest from*) from msg)])))
@ -388,8 +403,8 @@
(list "ada" "hello"))) (list "ada" "hello")))
(define (send addr msg from* to*) (define (send addr msg from* to*)
(make-package (make-world false false from* (enqueue to* addr msg)) (local ((define new-to* (enqueue (+ (image-height CURSOR) 2) to* addr msg)))
(list addr msg))) (make-package (make-world false false from* new-to*) (list addr msg))))
;; ----------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------
;; World String -> World ;; World String -> World