Skip to content

Commit

Permalink
adjust the text boxes inserted via DrRacket's Insert Text Box menu it…
Browse files Browse the repository at this point in the history
…em to respect dark mode

the change to snipclass-text-box% would not be necessary if the change in make-editor had been there all along, but as it is, this will affect saved files

closes racket/drracket#721
  • Loading branch information
rfindler committed Feb 23, 2025
1 parent 96ce626 commit fea1f2b
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions htdp-lib/xml/text-snipclass.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@
(define snipclass-text-box%
(class decorated-editor-snipclass%
(define/override (make-snip stream-in) (new text-box%))
(define/override (read stream-in)
(define snip (make-snip stream-in))
(define ed (send snip get-editor))
(send ed read-from-file stream-in #f)
(define style (send (send ed get-style-list) find-named-style (editor:get-default-color-style-name)))
(when style
(send ed change-style style 0 (send ed last-position)))
snip)
(super-instantiate ())))

(define old-snipclass (new snipclass-text-box%))
Expand All @@ -59,9 +67,10 @@

(define text-box%
(class* decorated-editor-snip% (readable-snip<%>)
(define/override (make-editor) (let ([e (new text:keymap%)])
(send e set-max-undo-history 'forever)
e))
(define/override (make-editor)
(define e (new (text:foreground-color-mixin text:keymap%)))
(send e set-max-undo-history 'forever)
e)
(define/override (make-snip) (make-object text-box%))
(inherit get-editor get-admin)

Expand Down

0 comments on commit fea1f2b

Please sign in to comment.