(define-record-type element :element (make-element markable? marked? value painter) element? (markable? element-markable?) (marked? element-marked?) (value element-value) (painter element-painter)) (define-record-discloser :element (lambda (r) `(element ,(element-marked? r) ,(element-value r)))) (define (make-unmarked-element value markable? painter) (make-element markable? #f value painter)) (define (make-marked-element value markable? painter) (make-element markable? #t value painter)) (define (make-unmarked-text-element value markable? text) (make-unmarked-element value markable? (make-text-painter text))) (define (make-marked-text-element value markable? text) (make-marked-element value markable? (make-text-painter text))) (define (make-text-painter text) (lambda (win x y width at-cursor? marked?) (if at-cursor? (wattron win (A-REVERSE))) (if marked? (wattron win (A-BOLD))) (mvwaddstr win y x text) (if (or at-cursor? marked?) (wattrset win (A-NORMAL))) (+ x (string-length text))))