Version: (using KDE Devel) Installed from: Compiled sources The online spell checker (the one that shows incorrect words in a blue font) sometimes replaces the wrong word if you use one of the suggestions from the RMB menu. To reproduce type some text so that there's an error in the second line. Use a suggestion and text in the first line will be replaced instead. This only happens when you ended the first line with return, not when you continue typing so that automatic word wrapping is used.
*** Bug 66353 has been marked as a duplicate of this bug. ***
Subject: kdepim/kmail CVS commit by kloecker: Fix problems with replacing misspelled words. Based on patch by Daniel Naber. CCMAIL: 66172-fixed@bugs.kde.org CCMAIL: 66174-fixed@bugs.kde.org M +6 -10 kmcomposewin.cpp 1.759 --- kdepim/kmail/kmcomposewin.cpp #1.758:1.759 @@ -5886,14 +5886,10 @@ bool KMEdit::eventFilter(QObject*o, QEve int parIdx = 1, txtIdx = 1; getCursorPosition(&parIdx, &txtIdx); - - //Put in our replacement - QString txtContents = text(); - QString newContents = txtContents.left(firstSpace) + mReplacements[word][id] + - txtContents.right( txtContents.length() - lastSpace ); - setText( newContents ); - - //Restore the cursor position - if( txtIdx > lastSpace ) - txtIdx += newContents.length() - txtContents.length(); + setSelection(para, firstSpace, para, lastSpace); + insert(mReplacements[word][id]); + // Restore the cursor position; if the cursor was behind the + // misspelled word then adjust the cursor position + if ( para == parIdx && txtIdx >= lastSpace ) + txtIdx += mReplacements[word][id].length() - word.length(); setCursorPosition(parIdx, txtIdx); }