From kmail-devel Fri Oct 31 00:48:02 2003 From: Ingo "Klöcker" Date: Fri, 31 Oct 2003 00:48:02 +0000 To: kmail-devel Subject: [Bug 66172] spell suggestion replaces wrong word X-MARC-Message: https://marc.info/?l=kmail-devel&m=106756132921824 ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. http://bugs.kde.org/show_bug.cgi?id=66172 kloecker@kde.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Additional Comments From kloecker@kde.org 2003-10-31 01:48 ------- 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); } _______________________________________________ KMail Developers mailing list kmail@mail.kde.org http://mail.kde.org/mailman/listinfo/kmail