Re: How do I turn off an attribute?

Subject: Re: How do I turn off an attribute?
From: Paul Rohr (
Date: Fri Mar 09 2001 - 19:54:47 CST

At 11:27 AM 3/10/01 +1100, Martin Sevior wrote:
> How do I turn off a specific attribute so that it is inherited
>from the previous span, paragraph or section? For example once someone
>starts a list then turns it off all subsequent paragraphs have an
>attribute "listid=0". I'd rather the listid attribute just disappeared.

I'm not sure I understand the question. More details might help. Some
questions that come to mind include:

  - These are CSS-like properties, and not attributes, right?
  - How did you get it turned on?
  - What *should* the value be?
  - What's the default value for that property?

In any event, based on what you describe, one or more of the following three
mechanisms could conceivably be involved.

1. pruning mechanism for redundant properties
We currently don't have code to recognize that an explicitly set property
matches the underlying defaults. For example, toggling "font-weight:bold"
off from the toolbar generates an explicit "font-weight:normal". That
explicit setting (usually) matches the underlying default, so it's
technically correct. However, in most cases what you'd probably prefer is
no font-weight at at all.

This behavior is theoretically harmless, but it clutters up the file format.
This could conceivably be fixed in a number of places, but I think Jeff's
preferred spot was to do so at export time. However, insofar as a bunch of
these could pile up during an editing session, it might be more efficient to
do so right when the change is made.

I'll send a separate post with thoughts on how such a pruning strategy might

2. default formatting while typing
There's also code somewhere in the block-level editing which sets the
default formatting for the next block to be the same as the prior one.
(This is the exact spot where support for the followedby atttribute for
styles should be implemented, BTW.) IIRC, this logic has been implemented
several different ways, most recently the oft-maligned FmtMark hack.

There are a lot of screw cases involving abandoned edits at this point, and
Jeff got almost all of them right. So, as much as the FmtMark stuff feels
wrong, nobody's done the careful detective work required to come up with a
more complete solution.

3. explicitly removing properties
Jeff did originally plan to add a piece table method so that views could
explicitly *remove* a specific property from an existing span. As it turned
out, I never needed it to make editing and formatting work, so he may not
have implemented it. If he did, it's never been used outside of unit tests.

Hope that's enough to get you started.


This archive was generated by hypermail 2b25 : Fri Mar 09 2001 - 21:13:17 CST