[racket-dev] [racket] Text highlighting on Windows

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Jul 14 09:29:08 EDT 2010

[Moved to dev list.]

Anyone interested in working on this? The relevant code is in


in `do-redraw'. Look for the use of `outline-brush'.

The current strategy for drawing the selection is to draw the plain
content and then apply a 'hilite brush over that. Under Windows and X,
a 'hilite brush inverts colors. Under Mac OS X, a 'hilite brush adds
the selection color on top of the drawing. The Mac OS X strategy is
roughly correct for that platform. I think other Windows apps, however,
handle highlighting differently: they draw some highlighting background
(e.g., dark blue) and then draw the content in a different mode (e.g.,
drawing white text instead of black or colored). I don't know what the
conventions are for X these days.

Since Windows highlighting is supposed to work completely differently
than the current strategy (I think), a good solution may require
extending the snip% protocol.

In GRacket2, there's no color-invert operation --- no xor drawing
supoprted by the underlying drawing library. So, that's another reason
that the strategy for Windows and X needs to change. Currently,
GRacket2 highlights using a transparent gray on all platforms (roughly
the same as GRacket1's 'hilite for Mac OS X).

At Tue, 13 Jul 2010 18:37:06 +0000 (UTC), George Horton wrote:
> Are there any plans to fix text highlighting on Windows, please? (It's bug
> 9202/10166: in Racket 5.0 on Windows 7, highlighted text is poorly rendered
> whatever rendering settings in DrRacket or Windows are used.) As far as I can
> tell, this is the only thing making Racket unsuitable for desktop apps with the
> polish needed for public distribution. 
> Thanks for any info,
> George

Posted on the dev mailing list.