<table><tr><td style="">poboiko created this revision.<br />poboiko added a reviewer: mlaurent.<br />Herald added a project: KDE PIM.<br />poboiko requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D29318">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>Instead of converting document to plain text, just loop over all encounters of the search string in the document and replace those.<br />
Otherwise we will lose all formatting in <tt style="background: #ebebeb; font-size: 13px;">RichTextEditor</tt>.</p>

<p>This way we're also able to respect the search settings (case sensitivity, whole word search).<br />
Also, provide user with a visual indication showing how many replacements were made (the same way Kate/KWrite does it).<br />
The latter two points also apply <tt style="background: #ebebeb; font-size: 13px;">PlainTextEditFindBar</tt>.</p>

<p>(in principle, to avoid code duplication, we can move this to <tt style="background: #ebebeb; font-size: 13px;">FindBarBase</tt>.<br />
We only need to access <tt style="background: #ebebeb; font-size: 13px;">mView->document()</tt>, which depends on the underlying text widget,<br />
so we could add a <tt style="background: #ebebeb; font-size: 13px;">virtual QTextDocument *document()</tt> method to FindBarBase and reimplement it)</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Tested case-sensitive and regular expression <tt style="background: #ebebeb; font-size: 13px;">Replace All</tt> on a rich-text document (having a list is already sufficient),<br />
the formatting is not messed up</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R86 PIM: Text Editor</div></div></div><br /><div><strong>BRANCH</strong><div><div>replaceAll (branched from master)</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D29318">https://phabricator.kde.org/D29318</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/texteditor/plaintexteditor/plaintexteditfindbar.cpp<br />
src/texteditor/richtexteditor/richtexteditfindbar.cpp</div></div></div><br /><div><strong>To: </strong>poboiko, mlaurent<br /><strong>Cc: </strong>kde-pim, fbampaloukas, dcaliste, dvasin, rodsevich, winterz, vkrause, mlaurent, knauss, dvratil<br /></div>