Hi all,
Thanks, Suzanne for the alternative ideas.
I ended up writing the code to find and wrap all instances and their
neighboring words with a _font PI. I still have a few implementation details
to work out such as how and when the code fires. Currently I have it firing
on startup and "toggling" from a menu pick, meaning you can essentially
show/hide the highlighting. I have not attached it to any hooks or callbacks
... I sort of think that would be over-kill. I can see authors perhaps
wanting the ability to add new "wrapping" without toggling off/on in order
to see "new" s, though. We'll see. Oh, the screen FOSI shows the
surrounding words in darkviolet (for now ... subject to author review). The
print FOSI ignores the PI altogether.
I learned about the discrepancy between length() and goto_oid($oid, $pos)
which is that s count for one character when navigating via $pos but
6 characters in length() and match(). This caused much frothing and steaming
before the final aha moment realization. I learned that Editor gets upset
when you (accidentally) try to nest PIs (and presumably any element) 100
levels deep and that it's nice if you pre-emptively code escapes when
oid_level(oid_root(), oid_caret()) > 25 or something similar before any
insert.
Not sure what the authors will want to see when they have something like
this:
<para></para>
There's nothing for me to highlight in that situation, so for now I've set
td -local -full on that PI. It looks something like this:
<para><_font></para>
I thought the <_font> would color-up, but no luck. Hopefully it's
enough of a visual cue for the authors.
Oh yeah, one last thing, I mapped Control-Alt-a to find('', 0x0530).
It helped me check how well my code was doing. Ironically, it might have
been enough for the authors 😉
Cheers.
On Wed, Aug 6, 2008 at 3:06 PM, Suzanne Napoleon <
SuzanneNapoleon@fosiexpert.com> wrote:
> Paul,
> If I understand the issue correctly, you could define a text entity such as
> the following:
> '>
> Note that you can change the text entity at any time to remove the _Font
> PI, if desired.
> Then define a keymapping for authors to use to insert the text entity when
> a non-breaking space is desired. The default keymapping for Control+Shift+Space
> is InsertNbsp. You could re-map that.
>
> A startup file would need to include td _Font -none to hide the _Font PI
> in the Edit window.
>
> Hope this helps!
>
> Good luck!
> Suzanne Napoleon
> www.FOSIexpert.com
>