Re: Small error in ap_EditMethods.cpp

Paul Rohr (paul@abisource.com)
Wed, 11 Nov 1998 10:03:57 -0800


At 03:07 AM 11/11/98 -0500, James wrote:
>As to the lack of a check mark on the bold, italic, underline and strikeout
>menu items, in the above file, at line: 1426, it reads:
>
> pView->setCharFormat(props_out);
>when it should be:
> pView->setBlockFormat(props_out);
>
>well, at least this works under my system - now the checkmarks toggle on
>and off as they should...

Thanks for the additional diagnosis on this.

Unfortunately, this is almost certainly *not* the real fix you'll need. The
code in _toggleSpan gets the current character-level formatting, and then
resets it. Setting those properties at the block level instead may look
like it works, but you don't want to go there.

The real bug is more subtle. The FV_View::getCharFormat() logic attempts to
figure out the current properties which apply to three very different beasts:

- a naked insertion point
- a span of text with all the same properties
- spans of text with different properties

The first case is easy, and I'm pretty sure we get it right. However, the
other two are trickier.

If you take a look at your favorite word processor, you'll notice that we
only want to claim that text is, say, bold, if the entire span is bold. The
existing code gets pretty close, but there's a nasty off-by-one problem at
the left edge of the selection.

For example, if you select an entire bold passage it thinks it's not (left
edge off by one), but if you select a piece inside that passage, it gets it
right.

Guess what I'll be working on today? :-)

Paul



This archive was generated by hypermail 1.03b2.