Summary: | Spell check does not replace words | ||
---|---|---|---|
Product: | [Unmaintained] quanta | Reporter: | Karsten Schneider <ka> |
Component: | general | Assignee: | András Manţia <amantia> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Karsten Schneider
2004-02-12 23:31:51 UTC
This is something which seems to be broken on KDE 3.2+. It works if Quanta is compiled under KDE 3.1.4, so I suspect this is a problem triggered by a change in the Kate part. So from here comes the techincal part: In Quanta we use our own spell checking implementation based on KSpell, in order to skip HTML tags while checking. The corrected() signal of KSpell is connected to the following slot: void SpellChecker::corrected( const QString& originalword, const QString& newword, uint pos ) { KTextEditor::EditInterface* editIf = dynamic_cast<KTextEditor::EditInterface*>(m_currentDoc); m_replaceCount++; uint line, col; locatePosition( pos, line, col ); QString lineText = editIf->textLine(line); lineText.remove(col,originalword.length()); lineText.insert(col, newword); editIf->removeLine(line); editIf->insertLine(line, lineText); } m_currentDoc is a KTextEditor::Document* pointing to the current document. Here is the other involved method: void SpellChecker::locatePosition( uint pos, uint& line, uint& col ) { KTextEditor::EditInterface* editIf = dynamic_cast<KTextEditor::EditInterface*>(m_currentDoc); uint cnt = 0; line = col = 0; // Find pos -- CHANGEME: store the last found pos's cursor // and do these searched relative to that to // (significantly) increase the speed of the spellcheck for( ; line < editIf->numLines() && cnt <= pos; line++ ) cnt += editIf->lineLength(line) + 1; line--; col = pos - (cnt - editIf->lineLength(line)) + 1; } I've debugged and everything seems to be good. The correct line is found, the line is read (so lineText contains the current line, which means that the correct document is handled by the editIf), yet the editIf->removeLine(line); editIf->insertLine(line, lineText); does not have any effect. :-( The line is simply not changed. It works in KDE 3.1.4, the reporter used KDE 3.2.0 and I have CVS HEAD, where it doesn't work either. Do you have an idea what can be done to make this work again? A rather important bug visible only in Quanta... Andras CVS commit by amantia: Make the spellchecker actually replace the wrongly spelled words [#75106] CCMAIL: 75106-done@bugs.kde.org M +1 -0 ChangeLog 1.219 M +2 -3 plugins/spellchecker.cpp 1.13 --- kdewebdev/quanta/ChangeLog #1.218:1.219 @@ -17,4 +17,5 @@ - don't crash the table editor on invalid nested tables - don't crash when setting table/body/header/footer attributes for newly created tables [#74949] + - make the spellchecker actually replace the wrongly spelled words [#75106] - various parsing fixes - report bugs for "quanta" module, not for "quanta_be" --- kdewebdev/quanta/plugins/spellchecker.cpp #1.12:1.13 @@ -166,4 +166,5 @@ void SpellChecker::corrected( const QStr lineText.remove(col,originalword.length()); lineText.insert(col, newword); + m_currentDoc->setReadWrite(true); #ifdef BUILD_KAFKAPART if (editIfExt) @@ -176,7 +177,5 @@ void SpellChecker::corrected( const QStr editIfExt->editEnd(); #endif - kapp->processEvents(); -// m_currentDoc->removeText( line, col, line, col + originalword.length() ); -// m_currentDoc->insertText( line, col, newword ); + m_currentDoc->setReadWrite(false); } |