Tonight's Mozilla editor progress

Home and End now place the selection well enough, but when I have code that removes formatting (which promises to be a bear as it is!), it should deselect the selection when it (normally) shouldn't. Having to know when the selection should be collapsed to the end is a complication.

Other current problems:

  • Left and right arrows are built-in Mozilla caret mode functions, which means they'll walk right out of the editable area if I let them. They'll have to be rewritten with XBL behavior to not do that. (Actually, that shouldn't be too hard, though constraining to the editable widget may be.)
  • Completely emptying the content area breaks it. No exact idea why.
  • As mentioned, one can only add bold and italics, not remove them.
  • Backspace and delete assume each character is its own DOM node. IIRC, DOM's contract says text nodes may be normalized (that is, adjacent sibling text nodes may be combined into one text node) at any time. Empirically, at some point they're normalized and it's a problem; naïvely I thought some sort of ctrl mode was tripped, so it suddenly backspaced over words at a time, if that helps visualize the behavior.
  • Consecutive spaces act as in HTML, which is confusing. Arrowing left into a block of spaces made the caret disappear too, but I don't know how that's my fault yet. Entering a space when the text node before or after the caret has a space on that end should add a non-blocking space.