Hendrik Boom wrote on 04/30/2017 08:25 AM:
On Sat, Apr 29, 2017 at 05:24:39PM -0400, Neil Van Dyke wrote:
Alternatively, and simpler: you might have two window panes, one in which
the user writes Scribble source, and another that gives an almost-live
semi-WYSIWYG view of how the source would render. Ideally have the
semi-WYSIWYG one approximate UI cues like text cursor point and selection
highlighting in the semi-WYSIWG view.
This is the approach that makes sense to me. But pointing and
selecting in the semi-WYSIWYG window would probaby require deep
involvement in scribble's own code.
Doing it perfectly would. I'm proposing this as an exercise in clever
hacking for a student, not routine engineering.
For one approach, a semi-WYSIWYG program could "experiment" with the
renderer, to see what the output is for a given input construct, and see
whether it can trace the input text through, and what happens to it. If
it can't see where the text went, then maybe that text just appears
non-WYSIWYG with an box around it, and you can still represent points
and selections. But if the program can find the input text in the
output, then the program can look for attributes of the rendering in
which it is interested (mainly typeface/size/color changes), and
selectively apply those to its semi-WYSIWYG view.
Constructs that require more complex structure, like itemized lists, are
a harder problem, but not intractable, if you don't need to be perfect.
These are easier if you're wiling to send real valid documents through a
renderer, and remember things you've learned.
There are also some UI design decisions to make about how semi-WYSIWYG
handles output it can't figure out. Consider a user-defined procedure
`plural`, which, for example, takes the input "try" and ultimately
renders as "tries". You can't trace that text through (unless you want
to throw linguistics at this particular contrived example, which I
suspect would be irrelevant overkill for real world situations). You
might decide that such things are rendered semi-WYSIWYG as a two-part
input-output box, or you might just show the input in a box, or (if you
don't need to be editable) show only an approximation of the output, or
show only the output approximation except when the cursor/pointer is in
it or adjacent.
--
You received this message because you are subscribed to the Google Groups "Racket
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.