Subject: Re: Commit: fix that spelling + images bug
Date: Sat Mar 24 2001 - 02:07:17 CST
[I sent this yesterday as well, but I don't see it on the list?!?]
Basically, as was pointed out later in the thread, the problem is that
we need the current ABI_UCS_OBJECT to be treated both as a whitespace
and as a word. Former is needed for images, latter for fields.
Come to think of it, the correct fix is to translate fields to
ABI_UCS_FIELD and images to ABI_UCS_IMAGE and let the two be defined
as appropriate unicode values (i.e., non-whitespace and whitespace).
>>>>> "Dom" == Dom Lachowicz <email@example.com> writes:
Dom> Ok, so I've fixed that bug where spellcheck & images don't play
Dom> nicely with one another, or at least in the cases that we
Dom> discussed. Right now, as far as the spell-checker is concerned,
Dom> images don't exist. This was a 3 line change. I'll locate and
Dom> close the bug(s) in bugzilla.
Dom> Why did we get the bug in the 1st place? See fl_DocLayout.cpp
Dom> around line 340 for some "suspicious" code. We insert
Dom> UCS_ABI_OBJECT into the stream as a placeholder for various
Dom> reasons. Our problem was that we were also spell-checking this
Dom> character in our spell-checking routines.
Dom> So I added logic in fl_BlockLayout::_checkMultiWord to strip
Dom> ABI_UCS_OBJECT from the text being selected for spell-check.
The code in question used (as the comment sez) to insert spaces
instead of the ABI_UCS_OBJECT character - which is something I changed
to make selction work properly.
IMO the solution would be to change the ABI_UCS_OBJECT to space in the
Somewhat unrelated: looking at the code around line 2248 in
fl_BlockLayout.cpp where you made one of the changes, I see magic
constants. I _hate_ magic constants. They were invented by the Dark
Side to create bugs, I'm sure.
// for some reason, the spell checker fails on all 1-char words & really big ones
if ((wordLength > 1) &&
XAP_EncodingManager::instance->noncjk_letters(pBlockText+wordBeginning, wordLength) &&
(!bAllUpperCase || !m_pLayout->getSpellCheckCaps()) &&
(!UT_UCS_isdigit(pBlockText[wordBeginning])) && // still ignore first char==num words
(!bHasNumeric || !m_pLayout->getSpellCheckNumbers()) && // can these two lines be simplified?
(wordLength < 100))
PD_Document * pDoc = m_pLayout->getDocument();
XAP_App * pApp = XAP_App::getApp();
The magic constant 100 should be replaced with a macro IMO. And I
suspect it might not even be an issue with pspell, but as long as we
have ispell, I guess it needs to remain in the code.
This archive was generated by hypermail 2b25 : Sat Mar 24 2001 - 02:07:32 CST