RE: dogfood feedback -- Smart Quotes

Subject: RE: dogfood feedback -- Smart Quotes
From: WJCarpenter (bill-abisource@carpenter.ORG)
Date: Thu Feb 22 2001 - 19:19:12 CST

((Executive summary: I think the solution is at hand. Paul, would
you do a bugzilla if you haven't already?))

paul> 1. Type a closing double-quote at the end of a phrase.
paul> ------------------------------------------------------- (Ditto
paul> for paired single-quotes.) Change the matching open quote
paul> first, then the closing one, globbed together as a user-atomic
paul> change. Even with the existing undo mechanism, the IP should
paul> already wind up in the right place.

In fact, doing it this way would break the UNDO paradigm. The
sequence that typically happened was

         1. type a quote character
         2. type another character
         3. opening smart quote promotion, if appropriate
         4. type some more characters
         5. type a quote character
         6. type another character
         7. closing smart quote promotion, if appropriate

Obviously, the UNDO sequence must be at least the visible reverse of

paul> 2. Type a single-quote inside a contraction.
paul> 2.d. The proposed hack -- replace from the quote to the IP,
paul> which for most contractions should be only a few characters.

In this case, the UNDO record is simpler. There is always exactly a
single character or some kind of structural boundary after the quote.
That's when the smart quote decision is made. If the user types more
than that, then that "more typing" is the appropriate thing to UNDO

paul> Actually, the more I think about it, the more I like it. Small,
paul> localized code to handle a single exceptional case sounds like
paul> the effort is well-matched to the task.

paul> What am I missing?

It's not that you're missing something ... it's that your explanation
has "too many notes". We can collapse all of those cases and just say
that when smart quote stuff creates the aggregated UNDO blob, it not
only does the delete/insert of the old and new quote, but it also does
a delete/insert of the character following the replaced quote (and
does all that in an order such that the UNDO machinery does the
insertion point stuff that we've been talking about).

With this re-statement, the code is localized, works for a general
case instead of a special case, and is something I wish I had thought
of back in August 2000.

There are some boundary cases for when there is a structural boundary
(heh, heh, boundary cases ... I kill me! :-) after the quote instead
of a character, but they can surely be worked through. (Other than
that, it might have simply been a matter of deleting/inserting 2
characters instead of one in

paul> If you need to add GUI controls to toggle it on and off
paul> frequently, then the algorithm needs more work.

Well, I'd venture that there really isn't a need to toggle it on and
off *frequently*. You brought up the technical case of the UNDO not
doing what you thought it would do. Now let's get down to *use*

What situations would a user ask for an algorithm-driven smart quote
feature and then want to not have it affect contractions? BTW, I
*can* think of isolated examples, but the algorithm was designed to
take care of the most commonly occuring. (For example, an embedded
single quote gets turned into an apostrophe for a contraction only if
it's between two alphas. The algorithm is documented in the source
file mentioned above.)

If new cases are thunk up, the decision algorithm is mostly
table-driven, so it shouldn't be too much trouble to tweak. (I did
that so that alogorithms for other locales could be readily
implemented.) I would be surprised if there were no tweaks for the
algorithm over the next couple of years. I would be more suprised if
the algorithm were ever considered perfect. (I think automated telepathy
will have to be available for that.)

>> ((To be frank, it wasn't obvious to me that UNDO should do the

paul> A well-done undo mechanism is very, very simple to explain. The
paul> paradigm we've been using is that *any and all* changes made to
paul> your document can be undone. Period. This should apply to:

You have missed my point and wandered off. I agree 100% that UNDO
should work seamlessly with smart quotes. My point was that, even so,
a huge number of users won't ever think of that, and so perhaps a
different *additional* mechanism is needed anyhow.

bill@carpenter.ORG (WJCarpenter)    PGP 0x91865119
38 95 1B 69 C9 C6 3D 25    73 46 32 04 69 D6 ED F3

This archive was generated by hypermail 2b25 : Thu Feb 22 2001 - 19:18:28 CST