spell and undo interact badly (was Re: Newcomer)


Subject: spell and undo interact badly (was Re: Newcomer)
From: WJCarpenter (bill-abisource@carpenter.ORG)
Date: Sun Sep 10 2000 - 09:15:06 CDT


gp> I managed more or less reliably to make the software crash by
gp> using a lot of undo/redo and adding chars. The check speller then
gp> runs through the wall while expanding a buffer for insertion (the
gp> crash is while the memmove is done). I traced the issue back to:

gp> const UT_UCSChar * pSpan = getPointer(pft->getBufIndex());
gp> pt_PieceTable:326
gp> which returns NULL

I have also seen problems like this one, and it's actually a pretty
serious problem. See, for example, bugzilla bug #978 ("spell and undo
interact badly"). For the problems that you are seeing, are you able
to get them if you disable on-the-fly spell-checking? My guess is no.

spell-checking has the notion of a "pending word". That's a fragment
of text that hasn't been spell-checked yet. The checking of the
"pending word" is done when the user types some word delimiter
character (e.g., space or most punctuation marks) or does something
that causes motion of the insertion point (e.g., mouse click, arrow
key) away from the pending word.

I think what is happening is that Undo/Redo can cause motion and
changes it the structures of blocks/runs in ways that the pending word
logic doesn't notice (or perhaps the change happens first, and then
pending word logic notices). In any case, spell-check's notion of
where the pending word is located at some point disagrees with the
actual current structure of the blocks/runs, and *boom*.

I predict that this is one of those problems with a huge amount of
study needed to be able to apply a simple 5-10 line fix. One hopes
that such a fix can be made without the spell-checking code becoming
incestuously intertwined with the Undo/Redo code. I may look at this
some day, but don't let that hold up anyone with an urge to dive in.

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

Buy my house in Woodinville (near Seattle): <http://www.johnlscott.com/57554>



This archive was generated by hypermail 2b25 : Mon Sep 11 2000 - 16:15:55 CDT